| | |
| | | |
| | | use app\common\model\plus\release\Project as ProjectModel; |
| | | use app\common\model\plus\release\ReleaseProjectImage as ReleaseProjectImageModel; |
| | | |
| | | use app\common\model\user\User as UserModel; |
| | | use app\common\model\user\PointsLog as PointsLogModel; |
| | | |
| | | /** |
| | | * 模型 |
| | |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($postdata,$demand) |
| | | public function add($postdata,$demand,$pay_price) |
| | | { |
| | | $data = json_decode($postdata["formData"],true); |
| | | if (empty($data['name'])) { |
| | |
| | | 'category_id'=>$data["category_id"], |
| | | 'price'=>$data["price"], |
| | | 'content'=>$data["content"], |
| | | 'product_content'=>$data["product_content"], |
| | | 'product_case'=>$data["product_case"], |
| | | 'detail'=>$data["detail"], |
| | | 'show_phone'=>$data["show_phone"], |
| | | 'is_show'=>$data["is_show"], |
| | |
| | | $save_data["finish_time"] = ''; |
| | | } |
| | | |
| | | return $this->transaction(function () use ($data, $save_data) { |
| | | return $this->transaction(function () use ($data, $save_data,$pay_price) { |
| | | // 记录内容 |
| | | $this->save($save_data); |
| | | // 记录图片 |
| | | $this->saveAllImages($this['project_id'],$data); |
| | | |
| | | //减少连盟币 |
| | | if($pay_price>0){ |
| | | (new UserModel())->where('user_id', '=', $save_data['user_id'])->dec('points',$pay_price)->update(); |
| | | PointsLogModel::add([ |
| | | 'user_id' => $save_data['user_id'], |
| | | 'value' => -$pay_price, |
| | | 'describe' => "发布需求消耗连盟币", |
| | | 'app_id' => $save_data['app_id'], |
| | | ]); |
| | | } |
| | | |
| | | return $this['project_id']; |
| | | }); |
| | |
| | | 'category_id'=>$data["category_id"], |
| | | 'price'=>$data["price"], |
| | | 'content'=>$data["content"], |
| | | 'product_content'=>$data["product_content"], |
| | | 'product_case'=>$data["product_case"], |
| | | 'detail'=>$data["detail"], |
| | | 'show_phone'=>$data["show_phone"], |
| | | 'is_show'=>$data["is_show"], |