Version.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\model\ActionLog;
  4. use app\admin\model\ProcessOrder;
  5. use app\BaseController;
  6. use think\App;
  7. use think\facade\Db;
  8. //版本
  9. class Version extends BaseController
  10. {
  11. public function __construct(App $app)
  12. {
  13. parent::__construct($app);
  14. $this->post = $this->request->post();
  15. }
  16. public function list(){
  17. $page = isset($this->post['page'])&&$this->post['page']!="" ? intval($this->post['page']) : 1;
  18. $size = isset($this->post['size'])&&$this->post['size']!="" ? intval($this->post['size']) :10;
  19. $count= Db::name("version")->count();
  20. $total = ceil($count/$size);
  21. $page = $page>=$total? $total:$page;
  22. $list = Db::name("version")->page($page,$size)->order("addtime desc")->select();
  23. return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
  24. }
  25. public function create(){
  26. $title = isset($this->post['title'])&&$this->post['title']!="" ? $this->post['title']:"";
  27. if($title==""){
  28. return error_show(1004,"参数title 不能为空");
  29. }
  30. $content = isset($this->post['content'])&&$this->post['content']!="" ? $this->post['content']:"";
  31. if($content==""){
  32. return error_show(1004,"参数content 不能为空");
  33. }
  34. $version = isset($this->post['version'])&&$this->post['version']!="" ? $this->post['version']:"";
  35. if($version==""){
  36. return error_show(1004,"参数version 不能为空");
  37. }
  38. $data=[
  39. "title"=>$title,
  40. "content"=>$content,
  41. "version"=>$version,
  42. "addtime"=>date("Y-m-d H:i:s")
  43. ];
  44. $inert= Db::name("version")->insert($data);
  45. if($inert){
  46. return app_show(0,"版本信息新建成功");
  47. }else{
  48. return app_show(0,"版本信息新建失败");
  49. }
  50. }
  51. public function info(){
  52. $projectNo = isset($this->post['projectNo'])&&$this->post['projectNo']!==""?trim($this->post['projectNo']):"";
  53. if($projectNo==""){
  54. return error_show(1004,"参数projectNo不能为空");
  55. }
  56. $type = isset($this->post['type'])&&$this->post['type']!=="" ? intval($this->post['type']) :0;
  57. $info =Db::name("project")->where(["projectNo"=>$projectNo,"is_del"=>0])->find();
  58. if($info==false){
  59. return error_show(1004,"未找到项目信息");
  60. }
  61. $plat = Db::name("platform")->where(['id'=>$info['platform_id']])->find();
  62. $info['platform_name']=isset($plat['platform_name'])?$plat['platform_name']:"";
  63. $info['platform_code']=isset($plat['platform_code'])?$plat['platform_code']:"";
  64. $userCommon = \app\admin\common\User::getIns();
  65. $tmp = $userCommon->handle('getCodeAndName', ['code' => [$info['companyNo'], $info['khNo']]]);
  66. $info['khName'] = $tmp['data'][$info['khNo']] ?? '';
  67. $info['company'] = $tmp['data'][$info['companyNo']] ?? '';
  68. // $khinfo = Db::name("customer_info")->where(["companyNo"=>$info['khNo']])->find();
  69. // $info['khName'] = isset($khinfo['companyName'])?$khinfo['companyName']:"";
  70. // $company = Db::name("business")->where(["companyNo"=>$info['companyNo']])->find();
  71. // $info['company'] = isset($company['company'])?$company['company']:"";
  72. $ladder = Db::name("project_info")->where(['projectNo'=>$projectNo,"is_del"=>0])->select()->toArray();
  73. $info['ladder']=[];
  74. if(!empty($ladder)){
  75. foreach ($ladder as $value){
  76. $value["cat_info"]=isset($value['cat_id']) &&$value['cat_id']!=""? made($value['cat_id'],[]):[];
  77. $condition = $type==0?['pgNo'=>$value['pgNo'],"is_del"=>0] : ['pgNo'=>$value['pgNo'],"is_del"=>0,"status"=>1];
  78. $feedback = Db::name("project_feedback")->where($condition)->select()->toArray();
  79. array_walk($feedback,function (&$v){
  80. $v["cat_info"]=isset($v['cat_id'])&&$v['cat_id']!=""? made($v['cat_id'],[]):[];
  81. });
  82. $value['feedback']=$feedback;
  83. $info['ladder'][]=$value;
  84. }
  85. }
  86. return app_show(0,"获取成功",$info);
  87. }
  88. public function feedlist(){
  89. $page =isset($this->post['page'])&&$this->post['page']!=="" ? intval($this->post['page']):1;
  90. $size =isset($this->post['size'])&&$this->post['size']!==""? intval($this->post['size']):10;
  91. $where=[["is_del","=",0]];
  92. $pgNo =isset($this->post['pgNo'])&&$this->post['pgNo']!==""?trim($this->post['pgNo']):"";
  93. if($pgNo!==""){
  94. $where[]=["pgNo","=",$pgNo];
  95. }
  96. $projectNo =isset($this->post['projectNo'])&&$this->post['projectNo']!==""?trim($this->post['projectNo']):"";
  97. if($projectNo!==""){
  98. $where[]=["projectNo","=",$projectNo];
  99. }
  100. $source =isset($this->post['source'])&&$this->post['source']!==""?intval($this->post['source']):"";
  101. if($source!==""){
  102. $where[]=["data_source","=",$source];
  103. }
  104. $cat_id =isset($this->post['cat_id'])&&$this->post['cat_id']!==""?intval($this->post['cat_id']):"";
  105. if($cat_id!==""){
  106. $where[]=["cat_id","=",$cat_id];
  107. }
  108. $status =isset($this->post['status'])&&$this->post['status']!==""?intval($this->post['status']):"";
  109. if($status!==""){
  110. $where[]=["status","=",$status];
  111. }
  112. $count = Db::name('project_feedback')->where($where)->count();
  113. $total = ceil($count / $size);
  114. $page = $page >= $total ? $total : $page;
  115. $list = Db::name('project_feedback')->where($where)->page($page,$size)->order("addtime desc")->select();
  116. $data=[];
  117. foreach ($list as $value){
  118. $value['can']=isset($value['cat_id'])&&$value['cat_id']!=""?made($value['cat_id']):"";
  119. if($value['data_source']==1){
  120. $good=Db::name("good_platform")->alias("a")->leftJoin("good b","a.spuCode=b.spuCode")->where
  121. (["a.skuCode"=>$value['skuCode'],"a.is_del"=>0])->find();
  122. $nake = Db::name("good_nake")->where([["spuCode","=",$value['spuCode']],["min_num","<=",
  123. $value["num"]],["is_del","=",0]])->order("min_num desc")->find();
  124. $good['unit_id'] = isset($good['good_unit'])?$good['good_unit']:"";
  125. $good['cost_desc'] = isset($good['craft_desc'])?$good['craft_desc']:"";
  126. $good['pakge_fee'] = isset($nake['package_fee'])?$nake['package_fee']:"0";
  127. $good['mark_fee'] = isset($nake['mark_fee'])?$nake['mark_fee']:"0";
  128. $good['other_fee'] = isset($nake['other_fee'])?$nake['other_fee']:"0";
  129. $good['cert_fee'] = isset($nake['cert_fee'])?$nake['cert_fee']:"0";
  130. $good['delivery_fee'] = isset($nake['delivery_fee'])?$nake['delivery_fee']:"0";
  131. $good['nake_fee'] = isset($nake['nake_fee'])?$nake['nake_fee']:"0";
  132. $good['metal_id'] = isset($good['noble_metal'])?$good['noble_metal']:"0";
  133. $spec = Db::name("good_spec")->where(["spuCode"=>$good['spuCode'],"is_del"=>0])->select()->toArray();
  134. $good['specinfo']=[];
  135. if(!empty($spec)){
  136. foreach ($spec as $vae){
  137. $specs=Db::name("specs")->where(["id"=>$vae['spec_id']])->find();
  138. $spec_value = Db::name("spec_value")->where(["id"=>$vae["spec_value_id"]])->find();
  139. $temp = ["specid"=>$vae['spec_id'],"spec_name"=>$specs['spec_name'],"spec_value_id"=>$vae['spec_value_id'],"spec_value_name"=>$spec_value["spec_value"]];
  140. $good['specinfo'][]=$temp;
  141. }
  142. }
  143. $nake =Db::name("good_nake")->where(["spuCode"=>$good['spuCode'],"is_del"=>0])->where([["min_num","<=",$value['num']]])
  144. ->order("min_num desc")->find();
  145. $good['origin_price']=$nake['nake_total'];
  146. $good['work_day']=$good['lead_time'];
  147. $good_img = $good['good_thumb_img'];
  148. }else{
  149. $good=Db::name("consult_bids")->where(["spuCode"=>$value['spuCode'],"is_del"=>0])->find();
  150. $good['specinfo'] = isset($good['specinfo'])&&$good['specinfo']!=""?json_decode($good['specinfo'],
  151. true):"";
  152. $catinfo = Db::name("cat")->where(["id"=>$good['cat_id']])->find();
  153. $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:100;
  154. $good_img = $good['good_img'];
  155. }
  156. $nobel =\think\facade\Config::get("noble");
  157. $value['good_name'] = isset($good['good_name'])?$good['good_name']:"";
  158. // $value['good_img'] = isset($good['good_img'])?$good['good_img']:"";
  159. $value['brand_id'] = isset($good['brand_id'])?$good['brand_id']:"";
  160. $brand = Db::name("brand")->where(['id'=>$value["brand_id"]])->find();
  161. $value['brand_name'] =isset($brand['brand_name']) ? $brand['brand_name']:"";
  162. $value['specinfo'] = isset($good['specinfo'])&&$good['specinfo']!=""?$good['specinfo']:[];
  163. $value['unit_id'] = isset($good['unit_id'])?$good['unit_id']:"";
  164. $unit = Db::name("unit")->where(['id'=>$value["unit_id"]])->find();
  165. $value["unit_name"]=isset($unit['unit'])?$unit['unit']:"";
  166. $value['cost_desc'] = isset($good['cost_desc'])?$good['cost_desc']:"";
  167. $value['work_day'] = isset($good['work_day'])?$good['work_day']:"";
  168. $value['delivery_day'] = isset($good['delivery_day'])?$good['delivery_day']:"";
  169. $value['expire_day'] = isset($good['expire_day'])?$good['expire_day']:"0";
  170. $value['good_img'] = $good_img;
  171. $value['expire_day'] = isset($good['expire_day'])?$good['expire_day']:"";
  172. $value['origin_place'] = isset($good['origin_place'])?$good['origin_place']:"";
  173. $value['supplierNo'] = isset($good['supplierNo'])?$good['supplierNo']:"";
  174. $value['pay_way'] = isset($good['pay_way'])?$good['pay_way']:"";
  175. $value['tax'] = isset($good['tax'])?$good['tax']:"";
  176. $value['send_way'] = isset($good['send_way'])?$good['send_way']:"";
  177. $value['metal_id'] = isset($good['metal_id'])?$good['metal_id']:"";
  178. $value['metal_name'] = isset($nobel[$good['metal_id']])?$nobel[$good['metal_id']]:"";
  179. $value['is_gold_price'] = isset($good['is_gold_price'])?$good['is_gold_price']:"0";
  180. $value['config'] = isset($good['config'])?$good['config']:"";
  181. $value['other_config'] = isset($good['other_config'])?$good['other_config']:"";
  182. $value['weight'] = isset($good['weight'])?$good['weight']:"";
  183. $value['is_diff'] = isset($good['is_diff'])?$good['is_diff']:"0";
  184. $value['demo_fee'] = isset($good['demo_fee'])?$good['demo_fee']:"0";
  185. $value['deivery_fee'] = isset($good['deivery_fee'])?$good['deivery_fee']:"0";
  186. $value['open_fee'] = isset($good['open_fee'])?$good['open_fee']:"0";
  187. $value['pakge_fee'] = isset($good['pakge_fee'])?$good['pakge_fee']:"0";
  188. $value['nake_fee'] = isset($good['nake_fee'])?$good['nake_fee']:"0";
  189. $value['mark_fee'] = isset($good['mark_fee'])?$good['mark_fee']:"0";
  190. $value['cert_fee'] = isset($good['cert_fee'])?$good['cert_fee']:"0";
  191. $value['cost_fee'] = isset($good['cost_fee'])?$good['cost_fee']:"0";
  192. $value['rate'] = $value['sale_price'] == 0 ? 0 : round(($value['sale_price'] - $value['origin_price']) / $value['sale_price'] * 100, 2);
  193. $value['supply_area'] = isset($good['supply_area'])?$good['supply_area']:"";
  194. $data[]=$value;
  195. }
  196. return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
  197. }
  198. public function project_plan(){
  199. $projectNo = isset($this->post['projectNo'])&&$this->post['projectNo']!==""?trim($this->post['projectNo']):"";
  200. if($projectNo==""){
  201. return error_show(1004,"参数projectNo不能为空");
  202. }
  203. $type = isset($this->post['type'])&&$this->post['type']!=="" ? intval($this->post['type']) :0;
  204. $info =Db::name("project")->where(["projectNo"=>$projectNo,"is_del"=>0])->find();
  205. if($info==false){
  206. return error_show(1004,"未找到项目信息");
  207. }
  208. $plat = Db::name("platform")->where(['id'=>$info['platform_id']])->find();
  209. $info['platform_name']=isset($plat['platform_name'])?$plat['platform_name']:"";
  210. $info['platform_code']=isset($plat['platform_code'])?$plat['platform_code']:"";
  211. $userCommon = \app\admin\common\User::getIns();
  212. $names = $userCommon->handle('getCodeAndName', ['code' => $info['khNo']]);
  213. // $khinfo = Db::name("customer_info")->where(["companyNo"=>$info['khNo']])->find();
  214. $info['khName'] = $names['data'][$info['khNo']] ?? '';//isset($khinfo['companyName'])?$khinfo['companyName']:"";
  215. if($type==1){
  216. $where = ['projectNo'=>$projectNo,"is_del"=>0,"status"=>1];
  217. }else{
  218. $where = ['projectNo'=>$projectNo,"is_del"=>0];
  219. }
  220. $ladder = Db::name("project_plan")->where($where)->order("addtime desc")->select()->toArray();
  221. $info=[];
  222. if(!empty($ladder)){
  223. foreach ($ladder as $value){
  224. $value['feedback']=[];
  225. $feedback =Db::name("project_plan_rela")->where(["planNo"=>$value['planNo'],"is_del"=>0])->column("feedback_id,sale_price,sale_num");
  226. if(!empty($feedback)){
  227. $feedid = array_column($feedback,"feedback_id");
  228. $feedlist = Db::name("project_feedback")->where(["id"=>$feedid,"is_del"=>0])->select();
  229. if(!empty($feedlist)){
  230. foreach ($feedlist as $val){
  231. $key =array_search($val['id'],$feedid);
  232. $price = $feedback[$key]['sale_price'];
  233. $val["cat_info"]=isset($val['cat_id'])&&$val['cat_id']!=""? made($val['cat_id'],[]):[];
  234. $val["sale_price"]=$price;
  235. $val["origin_num"]=$val['num'];
  236. $val["num"]=$feedback[$key]['sale_num'];
  237. if($val['data_source']!=1){
  238. $good=Db::name("consult_bids")->where(["spuCode"=>$val['spuCode'],"is_del"=>0])->find();
  239. $good['specinfo']=isset($good['specinfo'])&&$good['specinfo']!=""?json_decode($good['specinfo'],true):[];
  240. }else{
  241. $good=Db::name("good")->where(["spuCode"=>$val['spuCode'],"is_del"=>0])->find();
  242. $spec = Db::name("good_spec")->where(["spuCode"=>$val['spuCode'],"is_del"=>0])->select()->toArray();
  243. $good['specinfo']=[];
  244. if(!empty($spec)){
  245. foreach ($spec as $vae){
  246. $specs=Db::name("specs")->where(["id"=>$vae['spec_id']])->find();
  247. $spec_value = Db::name("spec_value")->where(["id"=>$vae["spec_value_id"]])->find();
  248. $temp = ["specid"=>$vae['spec_id'],"spec_name"=>$specs['spec_name'],"spec_value_id"=>$vae['spec_value_id'],"spec_value_name"=>$spec_value["spec_value"]];
  249. $good['specinfo'][]=$temp;
  250. }
  251. }
  252. }
  253. if(isset($good['brand_id'])){
  254. $brand =Db::name("brand")->where(["id"=>$good['brand_id']])->find();
  255. }
  256. $val['good_img']=isset($good['good_img'])&&$good['good_img']!=""?trim($good['good_img']):"";
  257. $val['brand_id']=isset($good['brand_id'])&&$good['brand_id']!=""?$good['brand_id']:"";
  258. $val['brand_name']=isset($brand['brand_name'])&&$brand['brand_name']!=""?$brand['brand_name']:"";
  259. $val['specinfo']=isset($good['specinfo'])&&$good['specinfo']!=""?$good['specinfo']:[];
  260. $value['feedback'][]=$val;
  261. }
  262. }
  263. }
  264. $info[]=$value;
  265. }
  266. }
  267. return app_show(0,"获取成功",$info);
  268. }
  269. public function feedCheck(){
  270. $feedid = isset($this->post['feedid'])&&!empty($this->post['feedid']) ? $this->post['feedid'] :[];
  271. if(empty($feedid)){
  272. return error_show(1004,"参数feedid不能为空");
  273. }
  274. $feedid=array_unique($feedid);
  275. $selec = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0,"status"=>0])->select()->toArray();
  276. if(empty($selec)){
  277. return error_show(1004,"反馈数据信息未找到");
  278. }
  279. $pgnos =array_column($selec,"pgNo");
  280. $infolist = Db::name("project_info")->where(['pgNo'=>$pgnos])->select()->toArray();
  281. if(empty($infolist)){
  282. return error_show(1004,"项目商品数据未找到");
  283. }
  284. Db::startTrans();
  285. try{
  286. $up = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0,"status"=>0])->save(["status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
  287. if($up){
  288. foreach ($infolist as $value){
  289. $old_value_status = $value['status'];
  290. $value['status']=3;
  291. $value['updatetime']=date("Y-m-d H:i:s");
  292. $up = Db::name("project_info")->save($value);
  293. if($up){
  294. ActionLog::logAdd(['id'=>0,"nickname"=>'客户'], [
  295. "order_code" => $value['pgNo'],//项目编码
  296. "status" =>$old_value_status,//这里的status是之前的值
  297. "action_remark" => '',//备注
  298. "action_type" => "edit"//新建create,编辑edit更改状态status
  299. ], "PRI", 3, ["status" =>3, "updatetime" => date("Y-m-d H:i:s")]);
  300. $count = Db::name("project_info")->where(["projectNo"=>$value['projectNo'],"status"=>2])
  301. ->count();
  302. if($count==0){
  303. $pr=Db::name("project")->where(["projectNo" => $value['projectNo']])->find();
  304. if($pr==false){
  305. Db::rollback();
  306. return error_show(1004, "未找到项目信息");
  307. }
  308. $proc =Db::name("project")->where(["projectNo"=>$value['projectNo']])->save
  309. (["status"=>3,"updatetime"=>date("Y-m-d H:i:s")]);
  310. if(!$proc){
  311. Db::rollback();
  312. return error_show(1004,"反馈数据选择失败");
  313. }
  314. ActionLog::logAdd(['id'=>0,"nickname"=>'客户'], [
  315. "order_code" => $value['projectNo'],//项目编码
  316. "status" =>$pr['status'],//这里的status是之前的值
  317. "action_remark" => '',//备注
  318. "action_type" => "edit"//新建create,编辑edit更改状态status
  319. ], "PRO", 3, ["status" => 3, "updatetime" => date("Y-m-d H:i:s")]);
  320. $process = ["order_code" => $value['projectNo'], "order_id" => $pr['id'], "order_status" =>3, "order_type" => 'PRO',"before_status"=> $pr['status'],'holder_id'=>$pr['createrid']];
  321. ProcessOrder::AddProcess(['id'=>0,"nickname"=>'客户'], $process);
  322. }
  323. }else{
  324. Db::rollback();
  325. return error_show(1004,"反馈数据选择失败");
  326. }
  327. $consult =Db::name('consult_order')->where(["projectNo"=>$value['projectNo']])->find();
  328. if($consult!=false){
  329. $up=Db::name("consult_info")->where(['zxNo'=>$consult['zxNo'],"is_del"=>0,"status"=>1])->select()
  330. ->toArray();
  331. if(!empty($up)){
  332. $staar=Db::name("consult_info")->where(['zxNo'=>$consult['zxNo'],"is_del"=>0,"status"=>1])->save
  333. (["status"=>2,"updatetime"=>date("Y-m-d H:i:s")]);
  334. if($staar==false){
  335. Db::rollback();
  336. return error_show(1002, "项目咨询单招标结束失败");
  337. }
  338. }
  339. }
  340. }
  341. Db::commit();
  342. return app_show(0,"反馈数据选择成功");
  343. }else{
  344. Db::rollback();
  345. return error_show(1004,"反馈数据选择失败");
  346. }
  347. }catch (\Exception $e){
  348. Db::rollback();
  349. return error_show(1004,$e->getMessage());
  350. }
  351. }
  352. public function planCheck(){
  353. $planNos = isset($this->post['planNos'])&&!empty($this->post['planNos'])? $this->post['planNos'] :"";
  354. if($planNos==""){
  355. return error_show(1004,"参数planNos不能为空");
  356. }
  357. $status=isset($this->post['status'])&&$this->post['status']!=="" ? intval($this->post['status']):"";
  358. if($status==""){
  359. return error_show(1004,"参数status不能为空");
  360. }
  361. $selec = Db::name("project_plan")->where(["planNo"=>$planNos,'is_del'=>0,"status"=>0])->select()->toArray();
  362. if(empty($selec)){
  363. return error_show(1004,"项目方案数据信息未找到");
  364. }
  365. Db::startTrans();
  366. try{
  367. $up = Db::name("project_plan")->where(["planNo"=>$planNos,'is_del'=>0,"status"=>0])->save(["status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
  368. if($up) {
  369. foreach ($selec as $value){
  370. ActionLog::logAdd(['id'=>0,"nickname"=>'客户'], [
  371. "order_code" => $value['planNo'],//项目编码
  372. "status" =>0,//这里的status是之前的值
  373. "action_remark" => '',//备注
  374. "action_type" => "edit"//新建create,编辑edit更改状态status
  375. ], "PRP", 1, ["status" =>1, "updatetime" => date("Y-m-d H:i:s")]);
  376. }
  377. $project = array_column($selec, "projectNo");
  378. if (empty($project)) {
  379. Db::rollback();
  380. return error_show(1004, "方案选择失败");
  381. }
  382. $pr=Db::name("project")->where(["projectNo" => $project, "status" => 4])->find();
  383. if($pr==false){
  384. Db::rollback();
  385. return error_show(1004, "未找到项目信息");
  386. }
  387. $pro = Db::name("project")->where($pr)->save(["status" => 5, "updatetime" => date("Y-m-d H:i:s")]);
  388. if ($pro) {
  389. ActionLog::logAdd(['id'=>0,"nickname"=>'客户'], [
  390. "order_code" => $pr['projectNo'],//项目编码
  391. "status" =>4,//这里的status是之前的值
  392. "action_remark" => '',//备注
  393. "action_type" => "edit"//新建create,编辑edit更改状态status
  394. ], "PRO", 5, ["status" => 5, "updatetime" => date("Y-m-d H:i:s")]);
  395. $process = ["order_code" => $pr['projectNo'], "order_id" => $pr['id'], "order_status" =>5, "order_type" => 'PRO',"before_status"=> $pr['status'],'holder_id'=>$pr['createrid']];
  396. ProcessOrder::AddProcess(['id'=>0,"nickname"=>'客户'], $process);
  397. Db::commit();
  398. return app_show(0, "方案数据修改成功");
  399. }
  400. }
  401. Db::rollback();
  402. return error_show(1004,"方案选择失败");
  403. }catch (\Exception $e){
  404. Db::rollback();
  405. return error_show(1004,$e->getMessage()."|".$e->getLine());
  406. }
  407. }
  408. public function outOrder(){
  409. $param =$this->request->param();
  410. $outOrdr = isset($param['outCode'])&&$param['outCode']!=''? trim($param['outCode']) :"";
  411. if($outOrdr==""){
  412. return error_show(1004,"参数 outCode 不能为空");
  413. }
  414. $outinfo =Db::name("order_out")->where(["outCode"=>$outOrdr,"is_del"=>0])
  415. ->field("orderCode,outCode,apply_id,apply_name,addrid,post_name,post_code,sendtime,send_num,remark,addtime,updatetime")->find();
  416. if($outinfo==false){
  417. return error_show(1004,"未找到发货单信息");
  418. }
  419. $addrinfo =Db::name("order_addr")->where(["id"=>$outinfo['addrid']])->field("addr,addr_code,contactor,mobile,receipt_quantity")
  420. ->find();
  421. if($addrinfo==false){
  422. return error_show(1004,"未找到发货单地址信息");
  423. }
  424. $orderinfo =Db::name("sale")->where(["orderCode"=>$outinfo["orderCode"],"is_del"=>0])
  425. ->field("good_code,good_name,addtime,order_type")->find();
  426. if($orderinfo==false){
  427. return error_show(1004,"未找到订单信息");
  428. }
  429. $postdata=[];
  430. if($outinfo['post_code']!=''){
  431. $postCode = explode(",",$outinfo['post_code']);
  432. $postinfo =Db::name("express_data")->where(["post_code"=>$postCode[0]])->find();
  433. if($postinfo['status']>0){
  434. $postdata=json_decode($postinfo['post_data'],true);
  435. }
  436. }
  437. if($orderinfo['order_type']==3 || $orderinfo['order_type']==4){
  438. $good=Db::name("good_zixun")->where(["spuCode"=>$orderinfo['good_code'],"is_del"=>0])->find();
  439. }else{
  440. $good=Db::name("good")->where(["spuCode"=>$orderinfo['good_code'],"is_del"=>0])->find();
  441. }
  442. $info = GetInfoNoToken(["id"=>$outinfo['apply_id']]);
  443. $outinfo['apply_mobile'] ='';
  444. if($info['code']==0 && !empty($info['data'])) $outinfo['apply_mobile'] = $info['data']['mobile'] ?? '';
  445. $outinfo['addr'] = $addrinfo['addr'];
  446. $outinfo['contactor'] = $addrinfo['contactor'];
  447. $outinfo['mobile'] = $addrinfo['mobile'];
  448. $outinfo['receipt_num'] = $addrinfo['receipt_quantity'];
  449. $outinfo['good_name'] = $orderinfo['good_name'];
  450. $outinfo['good_code'] = $orderinfo['good_code'];
  451. $outinfo['order_time'] = $orderinfo['addtime'];
  452. $outinfo['post_data'] = $postdata;
  453. $outinfo['good_img'] = isset($good['good_img'])&&$good['good_img']!=""?trim($good['good_img']):"";
  454. return app_show(0,"获取成功",$outinfo);
  455. }
  456. }