作者 xwp
1 个管道 的构建 通过 耗费 9 秒

后台修改

... ... @@ -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());
... ...
... ... @@ -35,6 +35,13 @@
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Product_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-product_id" data-rule="required" data-source="product/index" class="form-control selectpage" name="row[product_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-nickname" class="control-label col-xs-12 col-sm-2">{:__('Area')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-area" data-rule="required" class="form-control" name="row[area]" type="text" >
... ...