...
|
...
|
@@ -66,6 +66,37 @@ class User extends Backend |
|
|
|
|
|
$result = $this->model->allowField(true)->insert($params,false,true);
|
|
|
if ($result !== false) {
|
|
|
if(isset($params['product_id']) && !empty($params['product_id'])){
|
|
|
|
|
|
$product = new \app\admin\model\Product();
|
|
|
$product = $product->where(['id'=>$params['product_id']])->find();
|
|
|
if(!empty($product)){
|
|
|
$product = $product->toArray();
|
|
|
|
|
|
$order_id = Random::uuid();
|
|
|
$order_id = str_replace("-","",$order_id);
|
|
|
|
|
|
$now = date('Y-m-d H:i:s');
|
|
|
$data['product_id'] = $params['product_id'];
|
|
|
$data['user_id'] = $result;
|
|
|
$data['order_id'] = $order_id;
|
|
|
$data['status'] = 'success';
|
|
|
$data['product_doc'] = json_encode($product);
|
|
|
$data['total'] = $product['price'];
|
|
|
$data['create_time'] = $now;
|
|
|
$data['third_order_id'] = '';
|
|
|
$data['count'] = $product['count'];
|
|
|
$data['remain'] = ($product['count'] == -1)?999999:$product['count'];
|
|
|
$data['start'] = $now;
|
|
|
$data['end'] = date('Y-m-d H:i:s',strtotime('+'.$product['dateCount'].' day',strtotime($now)));
|
|
|
$data['success_time'] = $now;
|
|
|
$data['notify'] = false;
|
|
|
|
|
|
$order = new \app\admin\model\Order();
|
|
|
$order->insertGetId($data);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
$this->success();
|
|
|
} else {
|
|
|
$this->error($this->model->getError());
|
...
|
...
|
|