|
@@ -124,7 +124,7 @@ class ApproachOrderForm extends Model
|
|
|
// 管理员修改订单状态
|
|
// 管理员修改订单状态
|
|
|
'adminStatus' => ['sn', 'status'],
|
|
'adminStatus' => ['sn', 'status'],
|
|
|
// 校验订单支付
|
|
// 校验订单支付
|
|
|
- 'verifyPayStack' => ['sn', 'note'],
|
|
|
|
|
|
|
+ 'verifyPayStack' => ['sn', 'note', 'status'],
|
|
|
// 会员下单
|
|
// 会员下单
|
|
|
'userOrder' => ['type','addressId', 'payType','goodsId','goodsNum', 'note', 'payPassword'],
|
|
'userOrder' => ['type','addressId', 'payType','goodsId','goodsNum', 'note', 'payPassword'],
|
|
|
];
|
|
];
|
|
@@ -147,7 +147,7 @@ class ApproachOrderForm extends Model
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($this->scenario == 'verifyPayStack'){
|
|
if ($this->scenario == 'verifyPayStack'){
|
|
|
- if ($this->_model['STATUS'] != \Yii::$app->params['orderStatus']['notPaid']['value']) {
|
|
|
|
|
|
|
+ if ($this->_model->STATUS != \Yii::$app->params['orderStatus']['notPaid']['value']) {
|
|
|
$this->addError('sn', '订单支付状态错误');
|
|
$this->addError('sn', '订单支付状态错误');
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -225,8 +225,8 @@ class ApproachOrderForm extends Model
|
|
|
* @param $attribute
|
|
* @param $attribute
|
|
|
*/
|
|
*/
|
|
|
public function isStatus($attribute){
|
|
public function isStatus($attribute){
|
|
|
- if(!in_array($this->type, \Yii::$app->params['orderStatus'])){
|
|
|
|
|
- $this->addError($attribute, '类型错误');
|
|
|
|
|
|
|
+ if($this->type && !in_array($this->type, \Yii::$app->params['orderStatus'])){
|
|
|
|
|
+ $this->addError($attribute, '订单状态类型错误');
|
|
|
return ;
|
|
return ;
|
|
|
}
|
|
}
|
|
|
if ($this->scenario == 'adminStatus'){
|
|
if ($this->scenario == 'adminStatus'){
|
|
@@ -295,13 +295,13 @@ class ApproachOrderForm extends Model
|
|
|
// 更新准订单状态为已支付
|
|
// 更新准订单状态为已支付
|
|
|
$this->_model->STATUS = $this->status;
|
|
$this->_model->STATUS = $this->status;
|
|
|
$this->_model->NOTE = json_encode($this->note);
|
|
$this->_model->NOTE = json_encode($this->note);
|
|
|
- $this->_model->PAY_AT = $this->note['paid_at'];
|
|
|
|
|
|
|
+ $this->_model->PAY_AT = Date::utcToTime($this->note['paid_at']);
|
|
|
$this->_model->EMAIL = $this->note['email'];
|
|
$this->_model->EMAIL = $this->note['email'];
|
|
|
if (!$this->_model->save()) {
|
|
if (!$this->_model->save()) {
|
|
|
throw new Exception(Form::formatErrorsForApi($this->_model->getErrors()));
|
|
throw new Exception(Form::formatErrorsForApi($this->_model->getErrors()));
|
|
|
}
|
|
}
|
|
|
// 更新订单商品的支付Email
|
|
// 更新订单商品的支付Email
|
|
|
- ApproachOrderGoods::updateAll(['EMAIL' => $this->email], 'ORDER_SN = :ORDER_SN', [':ORDER_SN' => $this->sn]);
|
|
|
|
|
|
|
+ ApproachOrderGoods::updateAll(['EMAIL' => $this->note['email']], 'ORDER_SN = :ORDER_SN', [':ORDER_SN' => $this->sn]);
|
|
|
|
|
|
|
|
// 同步准订单到正式订单
|
|
// 同步准订单到正式订单
|
|
|
Order::insertOne($this->_model->toArray());
|
|
Order::insertOne($this->_model->toArray());
|
|
@@ -315,7 +315,7 @@ class ApproachOrderForm extends Model
|
|
|
$transaction->commit();
|
|
$transaction->commit();
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
$transaction->rollBack();
|
|
$transaction->rollBack();
|
|
|
- $this->addError('edit', $e->getMessage());
|
|
|
|
|
|
|
+ $this->addError('edit', $e->getFile() . ' ' . $e->getMessage());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|