diff --git a/common/modelsgii/oldDb/ProductOrderItems.php b/common/modelsgii/oldDb/ProductOrderItems.php index cd61eb8..c50e08a 100644 --- a/common/modelsgii/oldDb/ProductOrderItems.php +++ b/common/modelsgii/oldDb/ProductOrderItems.php @@ -18,8 +18,9 @@ class ProductOrderItems extends \common\core\BaseActiveRecord public function rules() { return [ - [['product_order_id', 'drug_id'], 'integer'], - [['drug_image', 'drug_name', 'small_info', 'created_at', 'updated_at'], 'string'], + [['product_order_id', 'drug_id', 'dosage', 'number', 'type'], 'integer'], + [['buy_price', 'price'], 'number'], + [['drug_image', 'drug_name', 'small_info', 'drug_no', 'function', 'created_at', 'updated_at'], 'string'], ]; } diff --git a/member/modules/v1/controllers/ProductOrderController.php b/member/modules/v1/controllers/ProductOrderController.php index e1f6d13..4bfe2c9 100644 --- a/member/modules/v1/controllers/ProductOrderController.php +++ b/member/modules/v1/controllers/ProductOrderController.php @@ -10,6 +10,7 @@ use common\forms\ProductRefundForm; use common\jobs\ProductOrderSyncPlatformJob; use common\models\oldDb\Address; use common\models\oldDb\ChineseRepice; +use common\models\oldDb\Drug; use common\models\oldDb\DoctorInfo; use common\models\oldDb\GranularRepice; use common\models\oldDb\Prescription; @@ -198,7 +199,13 @@ class ProductOrderController extends BaseAppController ])->all(); } foreach ($west as $value) { - $value['content']=Json::decode($value['content']); + $value['content'] = Json::decode($value['content']); + if (is_array($value['content']) && !empty($value['content']['id']) && empty($value['content']['instruction'])) { + $drugInstruction = Drug::find()->select('instruction')->where(['id' => $value['content']['id']])->scalar(); + if ($drugInstruction) { + $value['content']['instruction'] = $drugInstruction; + } + } } $count = count($west); }else if($prescription && $prescription->cr_ids){ @@ -399,7 +406,7 @@ class ProductOrderController extends BaseAppController $this->requestValidate($post, [ ['order_id', 'required'] ]); - $ProductOrder = ProductOrder::find()->select('id,is_online,order_no,delivery_method,su_id,p_id,user_id,is_pay,prescription_type,address_id,address,decoct_price,items_price,process_price,treatement_price,total_pay_price,pay_method,trans_expenses,created_at,cancel_status,refund_status,status,pay_time')->where([ + $ProductOrder = ProductOrder::find()->select('id,store_id,is_online,order_no,delivery_method,su_id,p_id,user_id,is_pay,prescription_type,address_id,address,decoct_price,items_price,process_price,treatement_price,total_pay_price,pay_method,trans_expenses,created_at,cancel_status,refund_status,status,pay_time')->where([ 'id' => $post['order_id'], 'user_id' => \Yii::$app->user->identity->getId(), // 'store_id' => $post['store_id'] @@ -431,7 +438,7 @@ class ProductOrderController extends BaseAppController $h->select('name'); }])->asArray()->one(); $ProductOrderItems = ProductOrderItems::find()->where(['product_order_id' => $ProductOrder['id']])->with(['drug' => function($q){ - $q->select('id,drug_name,function,specification,usage,instruction'); + $q->select('id,drug_name,is_otc,type,function,specification,usage,instruction'); }])->asArray()->all(); $ProductOrder['count'] = count($ProductOrderItems);