Suppler.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\Ocr;
  4. use app\BaseController;
  5. use think\App;
  6. use think\facade\Db;
  7. class Suppler extends BaseController
  8. {
  9. public $post = "";
  10. public function __construct(App $app)
  11. {
  12. parent::__construct($app);
  13. $this->post=$this->request->post();
  14. }
  15. public function create(){
  16. $name = isset($this->post['name']) && $this->post['name'] !=="" ? trim($this->post['name']) :"";
  17. if($name==""){
  18. return error_show(1002,"参数name不能为空");
  19. }
  20. $rename = Db::name('supplier')->where(['is_del' => 0, 'name' => $name])->find();
  21. if (!empty($rename)) {
  22. return error_show(1002, "公司名称已存在");
  23. }
  24. $code = rand(0000,9999);
  25. $str = sprintf("%04d",$code);
  26. $tr="GYS-".date("Ymd")."-".$str;
  27. $source= isset($this->post['source']) && $this->post['source']!==""? intval($this->post['source']) :"";
  28. if($source===""){
  29. return error_show(1002,"供应商来源不能为空");
  30. }
  31. $token = isset($this->post['token'])&&$this->post['token']!='' ? trim($this->post['token']):"";
  32. if($token==''){
  33. return error_show(1005,"参数token不能为空");
  34. }
  35. $user =GetUserInfo($token);
  36. if(empty($user)||$user['code']!=0){
  37. return error_show(1002,"创建人数据不存在");
  38. }
  39. $createrid= isset($user["data"]['id']) ? $user["data"]['id'] : "";
  40. $creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
  41. $type = isset($this->post['type']) && $this->post['type']!==""? intval($this->post['type']) :"";
  42. if($type===""){
  43. return error_show(1002,"申请类型不能为空");
  44. }
  45. $coop_state = isset($this->post['coop_state']) && $this->post['coop_state'] !==""? intval($this->post['coop_state']):"";
  46. if($coop_state===""){
  47. return error_show(1002,"参数coop_state不能为空");
  48. }
  49. $category = isset($this->post['category']) && $this->post['category'] !==""? intval($this->post['category']):"";
  50. if($category===""){
  51. return error_show(1002,"参数category不能为空");
  52. }
  53. $delivery_way = isset($this->post['delivery_way']) && $this->post['delivery_way'] !==""? intval($this->post['delivery_way']):"";
  54. if($delivery_way===""){
  55. return error_show(1002,"参数delivery_way不能为空");
  56. }
  57. $level = isset($this->post['level']) && $this->post['level'] !==""? intval($this->post['level']):"";
  58. if($level===""){
  59. return error_show(1002,"参数level不能为空");
  60. }
  61. $supplier_type = isset($this->post['supplier_type']) && $this->post['supplier_type'] !==""? intval($this->post['supplier_type']):"";
  62. if($supplier_type===""){
  63. return error_show(1002,"参数supplier_type不能为空");
  64. }
  65. $pay_type = isset($this->post['pay_type']) && $this->post['pay_type'] !==""? intval($this->post['pay_type']):"";
  66. if($pay_type===""){
  67. return error_show(1002,"参数pay_type不能为空");
  68. }
  69. $prove_img = isset($this->post['prove_img']) && $this->post['prove_img'] !==""? trim($this->post['prove_img']):"";
  70. if($prove_img==""){
  71. return error_show(1002,"参数prove_img不能为空");
  72. }
  73. // $area = isset($this->post['area']) && $this->post['area']!==""? trim($this->post['area']) :"";
  74. // $city = isset($this->post['city']) && $this->post['city']!==""? trim($this->post['city']) :"";
  75. $nature = isset($this->post['nature']) && $this->post['nature']!==""? intval($this->post['nature']) :"";
  76. $is_platform = isset($this->post['is_platform']) && $this->post['is_platform']!==""? intval($this->post['is_platform']) :"0";
  77. $ticket_type = isset($this->post['ticket_type']) && $this->post['ticket_type']!==""? intval($this->post['ticket_type']) :"";
  78. $legaler = isset($this->post['legaler']) && $this->post['legaler']!==""? trim($this->post['legaler']) :"";
  79. $addr = isset($this->post['addr']) && $this->post['addr']!==""? trim($this->post['addr']) :"";
  80. $registercode= isset($this->post['registercode']) && $this->post['registercode']!==""? trim($this->post['registercode']) :"";
  81. $capital= isset($this->post['capital']) && $this->post['capital']!==""? intval($this->post['capital']) :"";
  82. $product_category= isset($this->post['product_category']) && $this->post['product_category']!==""? trim($this->post['product_category']) :"";
  83. $is_payment= isset($this->post['is_payment']) && $this->post['is_payment']!==""?trim($this->post['is_payment']) :"";
  84. $notice_mark= isset($this->post['notice_mark']) && $this->post['notice_mark']!==""?trim($this->post['notice_mark']) :"";
  85. $agreement= isset($this->post['agreement']) && $this->post['agreement']!==""?trim($this->post['agreement']) :"";
  86. $warehouse= isset($this->post['warehouse']) && $this->post['warehouse']!==""?trim($this->post['warehouse']) :"";
  87. $pay_day= isset($this->post['pay_day']) && $this->post['pay_day']!==""?trim($this->post['pay_day']) :"";
  88. $scope= isset($this->post['scope']) && $this->post['scope']!==""?trim($this->post['scope']) :"";
  89. $status= isset($this->post['status']) && $this->post['status']!==""?intval($this->post['status']) :"0";
  90. $registertime= isset($this->post['registertime']) && $this->post['registertime']!==""? $this->post['registertime'] :"";
  91. $supplier_img = isset($this->post['supplier_img']) && $this->post['supplier_img'] !=="" ? trim($this->post['supplier_img']):"";
  92. $contactor = isset($this->post['contactor']) && $this->post['contactor'] !=="" ? trim($this->post['contactor']):"";
  93. if($contactor==""){
  94. return error_show(1002,"参数contactor不能为空");
  95. }
  96. $mobile = isset($this->post['mobile']) && $this->post['mobile'] !=="" ? trim($this->post['mobile']):"";
  97. if($mobile==""){
  98. return error_show(1002,"参数mobile不能为空");
  99. }
  100. $position = isset($this->post['position']) && $this->post['position'] !=="" ? trim($this->post['position']):"";
  101. if($position==""){
  102. return error_show(1002,"参数position不能为空");
  103. }
  104. if($registercode==""){
  105. return error_show(1002,"参数registercode不能为空");
  106. }
  107. Db::startTrans();
  108. try{
  109. $data=[
  110. "name"=>$name,
  111. "source"=>$source,
  112. "coop_state"=>$coop_state,
  113. "category"=>$category,
  114. "delivery_way"=>$delivery_way,
  115. "level"=>$level,
  116. "supplier_type"=>$supplier_type,
  117. "pay_type"=>$pay_type,
  118. "registercode"=>$registercode,
  119. "capital"=>$capital,
  120. "product_category"=>$product_category,
  121. "is_payment"=>$is_payment,
  122. "notice_mark"=>$notice_mark,
  123. "agreement"=>$agreement,
  124. "warehouse"=>$warehouse,
  125. "pay_day"=>$pay_day,
  126. "scope"=>$scope,
  127. "status"=>$status,
  128. "code"=>$tr,
  129. "type"=>$type,
  130. "nature"=>$nature,
  131. "legaler"=>$legaler,
  132. "addr"=>$addr,
  133. "is_del"=>0,
  134. "ticket_type"=>$ticket_type,
  135. "addtime"=>date('Y-m-d H:i:s'),
  136. "updatetime"=>date("Y-m-d H:i:s"),
  137. "is_platform"=>$is_platform,
  138. "prove_img"=>$prove_img,
  139. "license_img"=>$supplier_img,
  140. "creater"=>$creater,
  141. "createrid"=>$createrid,
  142. "registertime"=>date('Y-m-d H:i:s')
  143. ];
  144. if($supplier_img!==""){
  145. $ocr=new Ocr();
  146. $datwa = $ocr->query("",$supplier_img);
  147. // var_dump($data);
  148. if($datwa['code']==0 && isset($datwa['data']['result'])){
  149. $license = $datwa['data']['result'];
  150. $data['legaler']= isset($license['legal_representative'])?$license['legal_representative']:"";
  151. $data['addr']= isset($license['address'])?$license['address']:"";
  152. $data['registertime']= isset($license['found_date'])? date("Y-m-d",strtotime(str_replace(["年","月","日"],[""],$license['found_date']))):"";
  153. $data['scope']= isset($license['business_scope'])?$license['business_scope']:"";
  154. $data['capital']= isset($license['registered_capital'])?str_replace("万元","",$license['registered_capital'])*10000:"";
  155. $data['nature']= isset($license['type'])?$license['type']:"";
  156. $data['status']=1;
  157. if($data['name']!=$license['name']){
  158. $data['remark']="企业名称与营业执照不匹配";
  159. $data['status']=0;
  160. }
  161. if($data['code']!=$license['registration_number']){
  162. $data['remark'].="企业名称与营业执照不匹配";
  163. $data['status']=0;
  164. }
  165. }else{
  166. $data['remark']="营业执照识别失败";
  167. $data['status']=0;
  168. }
  169. }
  170. $join = Db::name('supplier')->insert($data,true);
  171. if($join>0){
  172. $temp = [];
  173. $temp['code']=$tr;
  174. $temp['contactor'] =$contactor;
  175. $temp['mobile'] = $mobile;
  176. $temp['position'] = $position;
  177. $temp['email'] ="";
  178. $temp['is_del'] = 0;
  179. $temp['addtime'] = date("Y-m-d H:i:s");
  180. $temp['updatetime'] = date("Y-m-d H:i:s");
  181. $vp = Db::name('supplier_contact')->insert($temp);
  182. if ($vp == "") {
  183. Db::rollback();
  184. return error_show(1002, "添加失败");
  185. }
  186. Db::commit();
  187. return error_show(0,"添加成功") ;
  188. }else{
  189. Db::rollback();
  190. return error_show(1002,"添加失败");
  191. }
  192. }catch (\Exception $e) {
  193. Db::rollback();
  194. return error_show(1003, $e->getMessage());
  195. }
  196. }
  197. public function list(){
  198. $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1";
  199. $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
  200. $where =[['a.is_del',"=",0]];
  201. $name = isset($this->post['name']) && $this->post['name'] !=="" ? trim($this->post['name']):"";
  202. if($name !==""){
  203. $where[]=["a.name","like","%$name%"];
  204. }
  205. $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
  206. if($creater !==""){
  207. $where[] = ["a.creater","like","%$creater%"];
  208. }
  209. $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
  210. if($status!==""){
  211. $where[]= ["a.status","=",$status];
  212. }
  213. $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
  214. if($start!==""){
  215. $where[]=['a.addtime',">=",$start];
  216. }
  217. // $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
  218. // if($end !=""){
  219. // $where[]=['a.addtime',"<=",$end];
  220. // }
  221. $contactor = isset($this->post['contactor']) && $this->post['contactor'] !==""? trim($this->post['contactor']):"";
  222. if($contactor !=""){
  223. $where[]=["b.contactor","like","%$contactor%"];
  224. }
  225. $mobile = isset($this->post['mobile']) && $this->post['mobile'] !=="" ? intval($this->post['mobile']):"";
  226. if($mobile !=""){
  227. $where[] = ['b.mobile',"like","%$mobile%"];
  228. }
  229. $count = Db::name('supplier')->alias("a")
  230. ->join("supplier_contact b","b.code=a.code","left")
  231. ->where($where)->count();
  232. $total = ceil($count / $size);
  233. $page = $page >= $total ? $total : $page;
  234. $list = Db::name('supplier')->alias('a')
  235. ->join("supplier_contact b","b.code=a.code","left")
  236. ->where($where)->page($page,$size)->order("a.addtime desc")
  237. ->field("a.*,b.contactor,b.mobile")->select();
  238. return app_show("0","获取成功",['list'=>$list,'count'=>$count]);
  239. }
  240. public function edit(){
  241. $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']):"";
  242. if($id==""){
  243. return error_show(1002,"参数id不能为空");
  244. }
  245. $info = Db::name("supplier")->where(['id'=>$id,'is_del'=>0])->find();
  246. if($info==""){
  247. return error_show(1002,"未找到数据");
  248. }
  249. $source= isset($this->post['source']) && $this->post['source']!==""? trim($this->post['source']) :"";
  250. if($source==""){
  251. return error_show(1002,"供应商来源不能为空");
  252. }
  253. $type = isset($this->post['type']) && $this->post['type']!==""? trim($this->post['type']) :"";
  254. if($type==""){
  255. return error_show(1002,"申请类型不能为空");
  256. }
  257. $coop_state = isset($this->post['coop_state']) && $this->post['coop_state'] !==""? trim($this->post['coop_state']):"";
  258. if($coop_state==""){
  259. return error_show(1002,"参数coop_state不能为空");
  260. }
  261. $category = isset($this->post['category']) && $this->post['category'] !==""? trim($this->post['category']):"";
  262. if($category==""){
  263. return error_show(1002,"参数category不能为空");
  264. }
  265. $delivery_way = isset($this->post['delivery_way']) && $this->post['delivery_way'] !==""? trim($this->post['delivery_way']):"";
  266. if($delivery_way==""){
  267. return error_show(1002,"参数delivery_way不能为空");
  268. }
  269. $level = isset($this->post['level']) && $this->post['level'] !==""? trim($this->post['level']):"";
  270. if($level==""){
  271. return error_show(1002,"参数level不能为空");
  272. }
  273. $supplier_type = isset($this->post['supplier_type']) && $this->post['supplier_type'] !==""? trim($this->post['supplier_type']):"";
  274. if($supplier_type==""){
  275. return error_show(1002,"参数supplier_type不能为空");
  276. }
  277. $pay_type = isset($this->post['pay_type']) && $this->post['pay_type'] !==""? trim($this->post['pay_type']):"";
  278. if($pay_type==""){
  279. return error_show(1002,"参数pay_type不能为空");
  280. }
  281. $prove_img = isset($this->post['prove_img']) && $this->post['prove_img'] !==""? trim($this->post['prove_img']):"";
  282. if($prove_img==""){
  283. return error_show(1002,"参数prove_img不能为空");
  284. }
  285. $name = isset($this->post['name']) && $this->post['name'] !=="" ? trim($this->post['name']) :"";
  286. if($name==""){
  287. return error_show(1002,"数据标题不能为空");
  288. }
  289. $rename = Db::name('supplier')->where(['is_del' => 0, 'name' => $name])->find();
  290. if (!empty($rename)&&$rename['id']!=$id) {
  291. return error_show(1002, "公司名称已存在");
  292. }
  293. // $nature = isset($this->post['nature']) && $this->post['nature']!==""? trim($this->post['nature']) :"";
  294. $is_platform = isset($this->post['is_platform']) && $this->post['is_platform']!==""? intval($this->post['is_platform']) :"0";
  295. $ticket_type = isset($this->post['ticket_type']) && $this->post['ticket_type']!==""? trim($this->post['ticket_type']) :"";
  296. // $legaler = isset($this->post['legaler']) && $this->post['legaler']!==""? trim($this->post['legaler']) :"";
  297. // $addr = isset($this->post['addr']) && $this->post['addr']!==""? trim($this->post['addr']) :"";
  298. $registercode= isset($this->post['registercode']) && $this->post['registercode']!==""? trim($this->post['registercode']) :"";
  299. // $capital= isset($this->post['capital']) && $this->post['capital']!==""? intval($this->post['capital']) :"";
  300. $product_category= isset($this->post['product_category']) && $this->post['product_category']!==""? trim($this->post['product_category']) :"";
  301. $is_payment= isset($this->post['is_payment']) && $this->post['is_payment']!==""?trim($this->post['is_payment']) :"";
  302. $notice_mark= isset($this->post['notice_mark']) && $this->post['notice_mark']!==""?trim($this->post['notice_mark']) :"";
  303. $agreement= isset($this->post['agreement']) && $this->post['agreement']!==""?trim($this->post['agreement']) :"";
  304. $warehouse= isset($this->post['warehouse']) && $this->post['warehouse']!==""?trim($this->post['warehouse']) :"";
  305. $pay_day= isset($this->post['pay_day']) && $this->post['pay_day']!==""?trim($this->post['pay_day']) :"";
  306. // $scope= isset($this->post['scope']) && $this->post['scope']!==""?trim($this->post['scope']) :"";
  307. //// $status= isset($this->post['status']) && $this->post['status']!==""?trim($this->post['status']) :"";
  308. // $registertime= isset($this->post['registertime']) && $this->post['registertime']!==""? $this->post['registertime'] :"";
  309. $supplier_img = isset($this->post['supplier_img']) && $this->post['supplier_img'] !=="" ? trim($this->post['supplier_img']):"";
  310. $contactor = isset($this->post['contactor']) && $this->post['contactor'] !=="" ? trim($this->post['contactor']):"";
  311. if($contactor==""){
  312. return error_show(1002,"参数contactor不能为空");
  313. }
  314. $mobile = isset($this->post['mobile']) && $this->post['mobile'] !=="" ? trim($this->post['mobile']):"";
  315. if($mobile==""){
  316. return error_show(1002,"参数mobile不能为空");
  317. }
  318. $position = isset($this->post['position']) && $this->post['position'] !=="" ? trim($this->post['position']):"";
  319. if($position==""){
  320. return error_show(1002,"参数position不能为空");
  321. }
  322. if($registercode==""){
  323. return error_show(1002,"参数registercode不能为空");
  324. }
  325. Db::startTrans();
  326. try{
  327. $data=[
  328. "id"=>$id,
  329. "source"=>$source,
  330. "coop_state"=>$coop_state,
  331. "category"=>$category,
  332. "delivery_way"=>$delivery_way,
  333. "level"=>$level,
  334. "supplier_type"=>$supplier_type,
  335. "pay_type"=>$pay_type,
  336. "registercode"=>$registercode,
  337. "product_category"=>$product_category,
  338. "is_payment"=>$is_payment,
  339. "notice_mark"=>$notice_mark,
  340. "agreement"=>$agreement,
  341. "warehouse"=>$warehouse,
  342. "pay_day"=>$pay_day,
  343. "type"=>$type,
  344. "license_img"=>$supplier_img,
  345. "is_del"=>0,
  346. "status"=>$info['license_img']==$supplier_img ? $info['status']:0,
  347. "ticket_type"=>$ticket_type,
  348. "updatetime"=>date("Y-m-d H:i:s"),
  349. "is_platform"=>$is_platform,
  350. "prove_img"=>$prove_img
  351. ];
  352. if($supplier_img!=="" &&$info['license_img']!=$supplier_img){
  353. $ocr=new Ocr();
  354. $dataw = $ocr->query("",$supplier_img);
  355. // var_dump($data);
  356. if($dataw['code']==0 && isset($dataw['data']['result'])){
  357. $license = $dataw['data']['result'];
  358. $data['legaler']= isset($license['legal_representative'])?$license['legal_representative']:"";
  359. $data['addr']= isset($license['address'])?$license['address']:"";
  360. $data['registertime']= isset($license['found_date'])? date("Y-m-d",strtotime(str_replace(["年","月","日"],[""],$license['found_date']))):"";
  361. $data['scope']= isset($license['business_scope'])?$license['business_scope']:"";
  362. $data['capital']= isset($license['registered_capital'])?str_replace("万元","",$license['registered_capital'])*10000:"";
  363. $data['nature']= isset($license['type'])?$license['type']:"";
  364. $data['status']=1;
  365. if($data['name']!=$license['name']){
  366. $data['remark']="企业名称与营业执照不匹配";
  367. $data['status']=0;
  368. }
  369. if($data['code']!=$license['registration_number']){
  370. $data['remark'].="企业名称与营业执照不匹配";
  371. $data['status']=0;
  372. }
  373. }else{
  374. $data['remark']="营业执照识别失败";
  375. $data['status']=0;
  376. }
  377. }
  378. $join = Db::name('supplier')->where(['id'=>$id,'is_del'=>0])->save($data);
  379. if($join){
  380. $item = Db::name('supplier_contact')->where(['code'=>$join['code']])->find();
  381. $temp = [];
  382. isset($item['id']) && $item['id'] !== "" ? $temp['id'] = $item['id'] : '';
  383. $temp['code'] = $info['code'];
  384. $temp['contactor'] = $contactor;
  385. $temp['mobile'] = $mobile;
  386. $temp['position'] = $position;
  387. $temp['email'] ="";
  388. $temp['is_del'] = 0;
  389. isset($item['id']) && $item['id'] !== "" ? '' : $temp['addtime'] = date("Y-m-d H:i:s");
  390. $temp['updatetime'] = date("Y-m-d H:i:s");
  391. $vp = Db::name('supplier_contact')->save($temp);
  392. if ($vp == "") {
  393. Db::rollback();
  394. return error_show(1002, "更新失败");
  395. }
  396. Db::commit();
  397. return error_show(0,"编辑成功") ;
  398. }else{
  399. Db::rollback();
  400. return error_show(1002,"编辑失败");
  401. }
  402. }catch (\Exception $e) {
  403. Db::rollback();
  404. return error_show(1003, $e->getMessage());
  405. }
  406. }
  407. public function info(){
  408. $id = isset($this->post['id'])&& $this->post['id'] !=="" ? intval($this->post['id']) :"";
  409. if($id ==""){
  410. return error_show(1002,"参数id不能为空");
  411. }
  412. $info = Db::name('supplier')->where(['id'=>$id,'is_del'=>0])->find();
  413. if($info==""){
  414. return error_show(1002,"未找到数据");
  415. }
  416. $contact = Db::name("supplier_contact")->where(["code"=>$info['code'],"is_del"=>0])->find();
  417. $info['contact']=$contact;
  418. return app_show(0,"获取成功",$info);
  419. }
  420. public function del(){
  421. $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']) :"";
  422. $sup = Db::name('supplier')->where(["is_del"=>0,'id'=>$id])->find();
  423. if($sup==false){
  424. return error_show(1002,"供应商信息不存在");
  425. }
  426. $supp= Db::name('supplier')->update(['id'=>$id,'is_del'=>1,"updatetime"=>date("Y-m-d H:i:s")]);
  427. if($supp){
  428. return error_show(0,"删除成功");
  429. }else{
  430. return error_show(1002,"删除失败");
  431. }
  432. }
  433. public function status(){
  434. $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']):"";
  435. if($id==""){
  436. return error_show(1002,"参数id不能为空");
  437. }
  438. $info = Db::name("supplier")->where([["id","=",$id],["is_del","=",0]])->find();
  439. if(!$info){
  440. return error_show(1002,"未找到对应数据");
  441. }
  442. $status = isset($this->post['status']) && $this->post['status']!==""? intval($this->post['status']):"";
  443. if($status===""){
  444. return error_show(1002,"参数status不能为空");
  445. }
  446. if(!in_array($status,[0,1,2])){
  447. return error_show(1002,"参数status无效");
  448. }
  449. $info['status']=$status;
  450. $info['updatetime']=date("Y-m-d H:i:s");
  451. $msg = $status==1?"启用":"禁用";
  452. $update = Db::name("supplier")->save($info);
  453. return $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
  454. }
  455. }