Consult.php 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  1. <?php
  2. namespace app\admin\controller;
  3. use think\App;
  4. use think\facade\Db;
  5. class Consult extends Base
  6. {
  7. public function __construct(App $app)
  8. {
  9. parent::__construct($app);
  10. }
  11. // public function list(){
  12. // $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
  13. // $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) :"10";
  14. // $where=[['is_del',"=",0],["cat_id","<>",0]];
  15. // $zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
  16. // if ($zxNo !== "") {
  17. // $where[] = ['zxNo','=',$zxNo];
  18. // }
  19. // $sequenceNo = isset($this->post['sequenceNo']) && $this->post['sequenceNo'] !== "" ? trim($this->post['sequenceNo']) : "";
  20. // if ($sequenceNo !== "") {
  21. // $where[] = ['sequenceNo','like',"%$sequenceNo%"];
  22. // }
  23. // $salesman = isset($this->post['salesman']) && $this->post['salesman'] !== "" ? trim($this->post['salesman']) : "";
  24. // if ($salesman !== "") {
  25. // //$where["salesman"] =Db::Raw("like '%$salesman%'");
  26. // $where[]= ["salesman",'like',"%$salesman%"];
  27. // }
  28. // $cpName = isset($this->post['cpName']) && $this->post['cpName'] !== "" ? trim($this->post['cpName']) : "";
  29. // if ($cpName !== "") {
  30. // //$where["cpName"]= Db::Raw("like '%$cpName%'");
  31. // $where[]= ["cpName",'like',"%$cpName%"];
  32. // }
  33. // $khNo = isset($this->post['khNo']) && $this->post['khNo'] !== "" ? trim($this->post['khNo']) : "";
  34. // if ($khNo !== "") {
  35. // // $where['khNo'] = $khNo;
  36. // $where[]= ["khNo",'like',"%$khNo%"];
  37. // }
  38. // $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
  39. // if ($start !="") {
  40. // //$where = ["zxtime"=>Db::raw(">= '{$start}'")];
  41. // $where[]= ["zxtime",'>=',$start];
  42. // }
  43. // $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
  44. // if($end !=""){
  45. // $where[]= ["zxtime",'<=',$end];
  46. // }
  47. // $status = isset($this->post['status']) && $this->post['status'] !== "" ? trim($this->post['status']) : "";
  48. // if ($status !== "") {
  49. // $where[]= ["status",'=',$status];
  50. // }
  51. // $count = Db::name('consult')->where($where)->count();
  52. // $total = ceil($count / $size);
  53. // $page = $page >= $total ? $total : $page;
  54. // $list = Db::name('consult')->where($where)->page($page,$size)
  55. // ->select();
  56. // $data=[];
  57. // foreach ($list as $value){
  58. // $value['can']= isset($value['cat_id']) && $value['cat_id'] !=0 ? made($value['cat_id']):[];
  59. // $data[]=$value;
  60. // }
  61. // return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
  62. // }
  63. public function conlist(){
  64. $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
  65. $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) :"10";
  66. $where=[['a.is_del',"=",0],['b.is_del',"=",0]];
  67. $zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
  68. if ($zxNo !== "") {
  69. $where[] = ['a.zxNo','=',$zxNo];
  70. }
  71. // $sequenceNo = isset($this->post['sequenceNo']) && $this->post['sequenceNo'] !== "" ? trim($this->post['sequenceNo']) : "";
  72. // if ($sequenceNo !== "") {
  73. // $where[] = ['sequenceNo','like',"%$sequenceNo%"];
  74. // }
  75. $salesman = isset($this->post['salesman']) && $this->post['salesman'] !== "" ? trim($this->post['salesman']) : "";
  76. if ($salesman !== "") {
  77. //$where["salesman"] =Db::Raw("like '%$salesman%'");
  78. $where[]= ["b.salesman",'like',"%$salesman%"];
  79. }
  80. $cpName = isset($this->post['cpName']) && $this->post['cpName'] !== "" ? trim($this->post['cpName']) : "";
  81. if ($cpName !== "") {
  82. //$where["cpName"]= Db::Raw("like '%$cpName%'");
  83. $where[]= ["a.good_Name",'like',"%$cpName%"];
  84. }
  85. $khNo = isset($this->post['khNo']) && $this->post['khNo'] !== "" ? trim($this->post['khNo']) : "";
  86. if ($khNo !== "") {
  87. // $where['khNo'] = $khNo;
  88. $where[]= ["b.khNo",'like',"%$khNo%"];
  89. }
  90. $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
  91. if ($start !="") {
  92. //$where = ["zxtime"=>Db::raw(">= '{$start}'")];
  93. $where[]= ["a.addtime",'>=',$start];
  94. }
  95. $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
  96. if($end !=""){
  97. $where[]= ["a.addtime",'<=',$end];
  98. }
  99. $status = isset($this->post['status']) && $this->post['status'] !== "" ? trim($this->post['status']) : "";
  100. if ($status !== "") {
  101. $where[]= ["a.status",'=',$status];
  102. }
  103. $count = Db::name('consult_info')->alias("a")->leftJoin("consult_order b","a.zxNo=b.zxNo")->where($where)
  104. ->count();
  105. $total = ceil($count / $size);
  106. $page = $page >= $total ? $total : $page;
  107. $list =Db::name('consult_info')->alias("a")->leftJoin("consult_order b","a.zxNo=b.zxNo")->where($where)->page($page,$size)
  108. ->field("a.*,b.createrid,b.creater,b.is_project,b.projectNo,b.khNo,b.endtime,b.platform_code,b.saleid,b.salesman,b.depart")->select();
  109. $data=[];
  110. foreach ($list as $value){
  111. $value['can']= isset($value['cat_id']) && $value['cat_id'] !=0 ? made($value['cat_id']):[];
  112. $value['khname']="";
  113. if($value['khNo']!==""){
  114. $kh=Db::name("customer_info")->where(['companyNo'=>$value['khNo']])->find();
  115. $value['khname']= isset($kh['companyName'])?$kh['companyName']:"";
  116. }
  117. $data[]=$value;
  118. }
  119. return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
  120. }
  121. public function info(){
  122. $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) : "";
  123. if($id==""){
  124. return error_show(1002,"咨询单编号不能为空");
  125. }
  126. $fo = Db::name('consult')->where(['id'=>$id,'is_del'=>0])->find();
  127. $in= isset($fo['cat_id']) && $fo['cat_id'] !=0 ? made($fo['cat_id']):[];
  128. $fo['can']=$in;
  129. if(empty($fo)){
  130. return error_show(1002,"未找到咨询单编号");
  131. }else{
  132. return app_show(0,"获取成功",$fo);
  133. }
  134. }
  135. public function del(){
  136. $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) : "";
  137. $de = Db::name('consult')->where(['id'=>$id,'is_del'=>0])->find();
  138. if($de==false){
  139. return error_show(1002,'咨询单信息未找到');
  140. }
  141. $dell= Db::name('consult')->update(['id'=>$id,'is_del'=>1,'updatetime'=>date("Y-m-d H:i:s")]);
  142. if($dell){
  143. return error_show(0,"删除成功");
  144. }else
  145. return error_show(1002,"删除失败");
  146. }
  147. public function create(){
  148. $is_project= isset($this->post['is_project']) && $this->post['is_project'] !=="" ? intval($this->post['is_project']) : "";
  149. if($is_project===""){
  150. return error_show(1002,"参数is_project不能为空");
  151. }
  152. if($is_project==1){
  153. $projectNo= isset($this->post['projectNo']) && $this->post['projectNo'] !=="" ? trim($this->post['projectNo']) : "";
  154. if($projectNo===""){
  155. return error_show(1002,"参数projectNo不能为空");
  156. }
  157. }
  158. $khNo = isset($this->post['khNo']) && $this->post['khNo'] !=="" ? trim($this->post['khNo']) : "";
  159. if($khNo===""){
  160. return error_show(1002,"参数khNo不能为空");
  161. }
  162. $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !=="" ? trim($this->post['companyNo']) : "";
  163. if($companyNo===""){
  164. return error_show(1002,"参数companyNo不能为空");
  165. }
  166. $endtime = isset($this->post['endtime']) && $this->post['endtime'] !=="" ? $this->post['endtime'] : "";
  167. if($endtime===""){
  168. return error_show(1002,"参数endtime不能为空");
  169. }
  170. // $saleid = isset($this->post['saleid']) && $this->post['saleid'] !=="" ? intval($this->post['saleid']) : "";
  171. // if($saleid===""){
  172. // return error_show(1002,"参数saleid不能为空");
  173. // }
  174. // $depart = isset($this->post['depart']) && $this->post['depart'] !=="" ? intval($this->post['depart']) : "";
  175. // if($depart===""){
  176. // return error_show(1002,"参数depart不能为空");
  177. // }
  178. $platform_code = isset($this->post['platform_code']) && $this->post['platform_code'] !=="" ? trim($this->post['platform_code']) :
  179. "";
  180. if($platform_code===""){
  181. return error_show(1002,"参数platform_code不能为空");
  182. }
  183. $ladder = isset($this->post['ladder'])&&!empty($this->post['ladder']) ? $this->post['ladder']:"";
  184. if($ladder==""){
  185. return error_show(1005,"参数ladder不能为空");
  186. }
  187. $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
  188. if($token==''){
  189. return error_show(1005,"参数token不能为空");
  190. }
  191. $user =GetUserInfo($token);
  192. if(empty($user)||$user['code']!=0){
  193. return error_show(1002,"用户数据不存在");
  194. }
  195. $createrid= isset($user["data"]['id']) ? $user["data"]['id'] : "";
  196. $creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
  197. $depart= Db::name("depart_user")->where(["uid"=>$createrid,"status"=>1,"is_del"=>0])->find();
  198. $zxNo=makeNo("ZX");
  199. $data=[
  200. "zxNo"=>$zxNo,
  201. "createrid"=>$createrid,
  202. "creater"=>$creater,
  203. "is_project"=>$is_project,
  204. "projectNo"=>isset($projectNo) ? $projectNo:"",
  205. "khNo"=>$khNo,
  206. "companyNo"=>$companyNo,
  207. "endtime"=>$endtime,
  208. "salesman"=>$creater,
  209. "platform_code"=>$platform_code,
  210. "saleid"=>$createrid,
  211. "depart"=>isset($depart['itemid'])?$depart['itemid']:0,
  212. "status"=>0,
  213. "is_del"=>0,
  214. "addtime"=>date("Y-m-d H:i:s"),
  215. "updatetime"=>date("Y-m-d H:i:s"),
  216. ];
  217. $zx = Db::name("consult_order")->insert($data);
  218. if($zx){
  219. foreach ($ladder as $value){
  220. $infoNo=makeNo("INF");
  221. $specinfo=[];
  222. if(isset($value['specinfo']) &&!empty($value['specinfo'])){
  223. foreach ($value["specinfo"] as $v){
  224. $spec =Db::name("specs")->where(["id"=>$v['specid']])->find();
  225. $spec_value =Db::name("spec_value")->where(["id"=>$v['spec_value_id']])->find();
  226. $v['spec_name']=isset($spec['spec_name'])? $spec['spec_name']:"";
  227. $v['spec_value_name']=isset($spec_value['spec_value'])?$spec_value['spec_value']:"" ;
  228. $specinfo[]=$v;
  229. }
  230. }
  231. $info=[
  232. "infoNo"=>$infoNo,
  233. "zxNo"=>$zxNo,
  234. "spuCode"=>"",
  235. "good_name"=>$value['good_name'],
  236. "good_img"=>$value['good_img'],
  237. "cat_id"=>$value['cat_id'],
  238. "unit"=>$value['unit'],
  239. "brand_id"=>$value['brand_id'],
  240. "arrival_time"=>$value['arrival_time'],
  241. "specinfo"=>empty($specinfo)?"" : json_encode($specinfo),
  242. "cost_desc"=>$value['cost_desc'],
  243. "is_addrs"=>$value['is_addrs'],
  244. "is_custom"=>$value['is_custom'],
  245. "metal_id"=>$value['metal_id'],
  246. "config"=>isset($value['config'])?$value['config']:"",
  247. "other_config"=>isset($value['other_config'])?$value['other_config']:"",
  248. "specs_weight"=>isset($value['specs_weight'])?$value['specs_weight']:"0",
  249. "gold_price"=>isset($value['gold_price'])?$value['gold_price']:"0",
  250. "is_gold_price"=>isset($value['is_gold_price'])?$value['is_gold_price']:"0",
  251. "total_weight"=>isset($value['total_weight'])?$value['total_weight']:"0",
  252. "budget_price"=>$value['budget_price'],
  253. "num"=>$value['num'],
  254. "pgNo"=>isset($value['pgNo'])&&$value['pgNo']!==""?trim($value['pgNo']):"",
  255. "use_desc"=>$value['use_desc'],
  256. "remark"=>$value['remark'],
  257. "status"=>1,
  258. "is_del"=>0,
  259. "addtime"=>date("Y-m-d H:i:s"),
  260. "updatetime"=>date("Y-m-d H:i:s")
  261. ];
  262. $up = Db::name("consult_info")->insert($info);
  263. if(!$up){
  264. Db::rollback();
  265. return error_show(1004,'添加失败');
  266. }
  267. }
  268. return app_show(0,"新建成功",["zxNo"=>$zxNo]);
  269. }else{
  270. return error_show(1004,"新建失败");
  271. }
  272. }
  273. // public function zxadd(){
  274. // $good_name = isset($this->post['good_name'])&&$this->post['good_name']!==""?trim($this->post['good_name']):"";
  275. // if($good_name===""){
  276. // return error_show(1004,"参数good_name不能为空");
  277. // }
  278. // $zxNo = isset($this->post['zxNo'])&&$this->post['zxNo']!==""?trim($this->post['zxNo']):"";
  279. // if($zxNo===""){
  280. // return error_show(1004,"参数zxNo不能为空");
  281. // }
  282. //
  283. // $cat_id = isset($this->post['cat_id'])&&$this->post['cat_id']!==""?intval($this->post['cat_id']):"";
  284. // if($cat_id===""){
  285. // return error_show(1004,"参数cat_id不能为空");
  286. // }
  287. // $arrival_time = isset($this->post['arrival_time'])&&$this->post['arrival_time']!==""?$this->post['arrival_time']
  288. // :"";
  289. // if($arrival_time===""){
  290. // return error_show(1004,"参数arrival_time不能为空");
  291. // }
  292. // $good_img = isset($this->post['good_img'])&&$this->post['good_img']!==""?trim($this->post['good_img']):"";
  293. // if($good_img===""){
  294. // return error_show(1004,"参数good_img不能为空");
  295. // }
  296. // $is_custom = isset($this->post['is_custom'])&&$this->post['is_custom']!==""?intval($this->post['is_custom']):"";
  297. // if($is_custom===""){
  298. // return error_show(1004,"参数is_custom不能为空");
  299. // }
  300. // $unit = isset($this->post['unit'])&&$this->post['unit']!==""?trim($this->post['unit']):"";
  301. // if($unit===""){
  302. // return error_show(1004,"参数unit不能为空");
  303. // }
  304. // $brand_id = isset($this->post['brand_id'])&&$this->post['brand_id']!==""?intval($this->post['brand_id']):"";
  305. // if($brand_id===""){
  306. // return error_show(1004,"参数brand_id不能为空");
  307. // }
  308. // $material = isset($this->post['material'])&&$this->post['material']!==""?trim($this->post['material']):"";
  309. // if($material===""){
  310. // return error_show(1004,"参数material不能为空");
  311. // }
  312. // $color = isset($this->post['color'])&&$this->post['color']!==""?trim($this->post['color']):"";
  313. // if($color===""){
  314. // return error_show(1004,"参数color不能为空");
  315. // }
  316. // $cost_desc = isset($this->post['cost_desc'])&&$this->post['cost_desc']!==""?trim($this->post['cost_desc']):"";
  317. // if($cost_desc===""){
  318. // return error_show(1004,"参数cost_desc不能为空");
  319. // }
  320. // $model = isset($this->post['model'])&&$this->post['model']!==""?trim($this->post['model']):"";
  321. // if($model===""){
  322. // return error_show(1004,"参数model不能为空");
  323. // }
  324. //
  325. // $is_addrs = isset($this->post['is_addrs'])&&$this->post['is_addrs']!==""?intval($this->post['is_addrs']):"";
  326. // if($is_addrs===""){
  327. // return error_show(1004,"参数is_addrs不能为空");
  328. // }
  329. //
  330. // $metal_id = isset($this->post['metal_id'])&&$this->post['metal_id']!==""?trim($this->post['metal_id']):"";
  331. // if($metal_id===""){
  332. // return error_show(1004,"参数metal_id不能为空");
  333. // }
  334. // if($metal_id==0){
  335. // $config = isset($this->post['config'])&&!empty($this->post['config'])?$this->post['config']:"";
  336. // if($config===""){
  337. // return error_show(1004,"参数config不能为空");
  338. // }
  339. // $other_config = isset($this->post['other_config'])&&$this->post['other_config']!==""?trim($this->post['other_config'])
  340. // :"";
  341. // if($other_config===""){
  342. // return error_show(1004,"参数other_config不能为空");
  343. // }
  344. // $specs_weight = isset($this->post['specs_weight'])&&$this->post['specs_weight']!==""?floatval($this->post['specs_weight']):"";
  345. // if($specs_weight===""){
  346. // return error_show(1004,"参数specs_weight不能为空");
  347. // }
  348. // $gold_price = isset($this->post['gold_price'])&&$this->post['gold_price']!==""?floatval($this->post['gold_price']):"";
  349. // if($gold_price===""){
  350. // return error_show(1004,"参数gold_price不能为空");
  351. // }
  352. //
  353. // }
  354. // $budget_price = isset($this->post['budget_price'])&&$this->post['budget_price']!==""?floatval($this->post['budget_price']):"";
  355. // if($budget_price===""){
  356. // return error_show(1004,"参数budget_price不能为空");
  357. // }
  358. // $num = isset($this->post['num'])&&$this->post['num']!==""?intval($this->post['num']):"";
  359. // if($num===""){
  360. // return error_show(1004,"参数num不能为空");
  361. // }
  362. // $use_desc = isset($this->post['use_desc'])&&$this->post['use_desc']!==""?trim($this->post['use_desc']):"";
  363. // if($use_desc===""){
  364. // return error_show(1004,"参数use_desc不能为空");
  365. // }
  366. // $remark = isset($this->post['remark'])&&$this->post['remark']!==""?trim($this->post['remark']):"";
  367. // if($remark===""){
  368. // return error_show(1004,"参数remark不能为空");
  369. // }
  370. //
  371. // Db::startTrans();
  372. // try{
  373. // $infoNo=makeNo("INF");
  374. // $info=[
  375. // "infoNo"=>$infoNo,
  376. // "zxNo"=>$zxNo,
  377. // "spuCode"=>"",
  378. // "good_name"=>$good_name,
  379. // "good_img"=>$good_img,
  380. // "cat_id"=>$cat_id,
  381. // "unit"=>$unit,
  382. // "brand_id"=>$brand_id,
  383. // "arrival_time"=>$arrival_time,
  384. // "model"=>$model,
  385. // "color"=>$color,
  386. // "material"=>$material,
  387. // "cost_desc"=>$cost_desc,
  388. // "is_addrs"=>$is_addrs,
  389. // "is_custom"=>$is_custom,
  390. // "metal_id"=>$metal_id,
  391. // "config"=>isset($config)?$config:"",
  392. // "other_config"=>isset($other_config)?$other_config:"",
  393. // "specs_weight"=>isset($specs_weight)?$specs_weight:0,
  394. // "gold_price"=>isset($gold_price)?$gold_price:0,
  395. // "budget_price"=>$budget_price,
  396. // "num"=>$num,
  397. // "use_desc"=>$use_desc,
  398. // "remark"=>$remark,
  399. // "status"=>0,
  400. // "is_del"=>0,
  401. // "addtime"=>date("Y-m-d H:i:s"),
  402. // "updatetime"=>date("Y-m-d H:i:s")
  403. // ];
  404. // $up = Db::name("consult_info")->insert($info);
  405. // if($up){
  406. // Db::commit();
  407. // return app_show(0,"添加成功",["infoNo"=>$infoNo]);
  408. // }else{
  409. // Db::rollback();
  410. // return error_show(1004,'添加失败');
  411. // }
  412. // }catch (\Exception $e){
  413. // Db::rollback();
  414. // return error_show(1004,$e->getMessage());
  415. // }
  416. // }
  417. public function zxinfo(){
  418. $infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
  419. if($infoNo==""){
  420. return error_show(1004,"参数infoNo不能为空");
  421. }
  422. $zxinfo = Db::name("consult_info")->where(["infoNo"=>$infoNo,"is_del"=>0])->find();
  423. if($zxinfo==false){
  424. return error_show(1004,"未找到信息数据");
  425. }
  426. $zxorder = Db::name("consult_order")->where(["zxNo"=>$zxinfo['zxNo'],"is_del"=>0])->find();
  427. if($zxorder==false){
  428. return error_show(1004,"未找到咨询信息数据");
  429. }
  430. $cat =Db::name("cat")->where(["id"=>$zxinfo['cat_id']])->find();
  431. $budget = isset($cat['order_rate']) ? $cat['order_rate']:100;
  432. $zxinfo['can']= isset($zxinfo['cat_id']) && $zxinfo['cat_id'] !=0 ? made($zxinfo['cat_id'],[]):[];
  433. $zxinfo['khname']="";
  434. $zxinfo['original_price']=sprintf("%.2f",$zxinfo['budget_price']* (1 -$budget/100));
  435. $zxinfo['khNo']="";
  436. $zxinfo['brand_id']=$zxinfo['brand_id']==0 ?"":$zxinfo['brand_id'];
  437. $zxinfo['brand']="";
  438. $zxinfo['companyNo']=isset($zxorder['companyNo'])?$zxorder['companyNo']:"";
  439. $zxinfo['projectNo']=isset($zxorder['projectNo'])?$zxorder['projectNo']:"";
  440. $zxinfo['is_project']=isset($zxorder['is_project'])?$zxorder['is_project']:"";
  441. $zxinfo['company']="";
  442. $zxinfo['endtime']=isset($zxorder['endtime'])?$zxorder['endtime']:"";
  443. $zxinfo['platform_code'] =isset($zxorder['platform_code'])?$zxorder['platform_code']:"";
  444. $zxinfo['salesman'] =isset($zxorder['salesman'])?$zxorder['salesman']:"";
  445. $zxinfo['saleid'] =isset($zxorder['saleid'])?$zxorder['saleid']:"";
  446. $zxinfo['depart'] =isset($zxorder['depart'])?$zxorder['depart']:"";
  447. $zxinfo['project_name']="";
  448. $zxinfo['budget_total']="";
  449. $zxinfo['departinfo']=[];
  450. $zxinfo['unit_name']="";
  451. $zxinfo['specinfo']=json_decode($zxinfo['specinfo'],true);
  452. if($zxorder['khNo']!==""){
  453. $kh=Db::name("customer_info")->where(['companyNo'=>$zxorder['khNo']])->find();
  454. $zxinfo['khname']= isset($kh['companyName'])?$kh['companyName']:"";
  455. $zxinfo['khNo']= $zxorder['khNo'];
  456. }
  457. if($zxinfo['unit']!==""){
  458. $unit=Db::name("unit")->where(['id'=>$zxinfo['unit']])->find();
  459. $zxinfo['unit_name']= isset($unit['unit'])?$unit['unit']:"";
  460. }
  461. if($zxinfo['brand_id']!==""){
  462. $unit=Db::name("brand")->where(['id'=>$zxinfo['brand_id']])->find();
  463. $zxinfo['brand']= isset($unit['brand_name'])?$unit['brand_name']:"";
  464. }
  465. if($zxorder['companyNo']!==""){
  466. $kh=Db::name("business")->where(['companyNo'=>$zxorder['companyNo']])->find();
  467. $zxinfo['company']= isset($kh['company'])?$kh['company']:"";
  468. }
  469. if($zxorder['is_project']==1 && $zxorder['projectNo']!==""){
  470. $project = Db::name("project")->where(["projectNo"=>$zxorder['projectNo'],"is_del"=>0])->find();
  471. $zxinfo['project_name']=isset($project['project_name'])?$project['project_name']:"";
  472. $zxinfo['budget_total']=isset($project['budget_total'])?$project['budget_total']:"";
  473. $zxinfo['project_use_desc']=isset($project['use_desc'])?$project['use_desc']:"";
  474. $projectinfo = Db::name("project_info")->where(["pgNo"=>$zxinfo['pgNo']])->find();
  475. $zxinfo['pgNo'] = isset($projectinfo['pgNo']) ? $projectinfo['pgNo']:"";
  476. }
  477. if($zxorder['depart']>0){
  478. $zxinfo['departinfo']=GetPart($zxorder['depart']);
  479. }
  480. if($zxorder['platform_code']>0){
  481. $palt=Db::name("platform")->where(["id"=>$zxorder['platform_code']])->find();
  482. $zxinfo['platform_name']=isset($palt['platform_name'])?$palt['platform_name']:"";
  483. }
  484. return app_show(0,"获取成功",$zxinfo);
  485. }
  486. public function zxedit(){
  487. $infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
  488. if($infoNo==""){
  489. return error_show(1004,"参数infoNo不能为空");
  490. }
  491. $zxinfo = Db::name("consult_info")->where(["infoNo"=>$infoNo,"is_del"=>0])->find();
  492. if($zxinfo==false){
  493. return error_show(1004,"未找到信息数据");
  494. }
  495. $good_name= isset($this->post['good_name'])&&$this->post['good_name']!=""?trim($this->post['good_name']):"";
  496. if($good_name==""){
  497. return error_show(1003,"参数good_name不能为空");
  498. }
  499. $good_img= isset($this->post['good_img'])&&$this->post['good_img']!=""?trim($this->post['good_img']):"";
  500. if($good_img==""){
  501. return error_show(1003,"参数good_img不能为空");
  502. }
  503. $cat_id= isset($this->post['cat_id'])&&$this->post['cat_id']!=""?intval($this->post['cat_id']):"";
  504. if($cat_id==""){
  505. return error_show(1003,"参数cat_id不能为空");
  506. }
  507. $unit= isset($this->post['unit'])&&$this->post['unit']!=""?trim($this->post['unit']):"";
  508. if($unit==""){
  509. return error_show(1003,"参数unit不能为空");
  510. }
  511. $brand_id= isset($this->post['brand_id'])&&$this->post['brand_id']!==""?intval($this->post['brand_id']):"0";
  512. $arrival_time= isset($this->post['arrival_time'])&&$this->post['arrival_time']!=""?$this->post['arrival_time']:"";
  513. if($arrival_time==""){
  514. return error_show(1003,"参数arrival_time不能为空");
  515. }
  516. $specin= isset($this->post['specinfo'])&&!empty($this->post['specinfo'])?$this->post['specinfo']:"";
  517. if($specin==""){
  518. return error_show(1003,"参数specinfo不能为空");
  519. }
  520. // $color= isset($this->post['color'])&&$this->post['color']!=""?trim($this->post['color']):"";
  521. // if($color==""){
  522. // return error_show(1003,"参数color不能为空");
  523. // }
  524. // $material= isset($this->post['material'])&&$this->post['material']!=""?trim($this->post['material']):"";
  525. // if($material==""){
  526. // return error_show(1003,"参数material不能为空");
  527. // }
  528. $cost_desc= isset($this->post['cost_desc'])&&$this->post['cost_desc']!=""?trim($this->post['cost_desc']):"";
  529. if($cost_desc==""){
  530. return error_show(1003,"参数cost_desc不能为空");
  531. }
  532. $is_addrs= isset($this->post['is_addrs'])&&$this->post['is_addrs']!==""?intval($this->post['is_addrs']):"";
  533. if($is_addrs===""){
  534. return error_show(1003,"参数is_addrs不能为空");
  535. }
  536. $is_custom= isset($this->post['is_custom'])&&$this->post['is_custom']!==""?trim($this->post['is_custom']):"";
  537. if($is_custom===""){
  538. return error_show(1003,"参数is_custom不能为空");
  539. }
  540. $metal_id= isset($this->post['metal_id'])&&$this->post['metal_id']!==""?intval($this->post['metal_id']):"";
  541. if($metal_id===""){
  542. return error_show(1003,"参数metal_id不能为空");
  543. }
  544. $config = isset($this->post['config'])&& $this->post['config']!=""?trim($this->post['config']):"";
  545. $other_config = isset($this->post['other_config'])&& $this->post['other_config']!=""?trim($this->post['other_config']):"";
  546. $specs_weight = isset($this->post['specs_weight'])&& $this->post['specs_weight']!==""?floatval($this->post['specs_weight']):"";
  547. $gold_price = isset($this->post['gold_price'])&& $this->post['gold_price']!==""?floatval($this->post['gold_price']):"";
  548. $is_gold_price = isset($this->post['is_gold_price'])&& $this->post['is_gold_price']!==""?intval($this->post['is_gold_price']):"0";
  549. $budget_price = isset($this->post['budget_price'])&& $this->post['budget_price']!==""?floatval($this->post['budget_price']):"";
  550. $total_weight = isset($this->post['total_weight'])&& $this->post['total_weight']!==""?floatval($this->post['total_weight']):"";
  551. $num = isset($this->post['num'])&& $this->post['num']!==""?intval($this->post['num']):"";
  552. if($num===""){
  553. return error_show(1003,"参数num不能为空");
  554. }
  555. if($budget_price===""){
  556. return error_show(1003,"参数budget_price不能为空");
  557. }
  558. $pgNo = isset($this->post['pgNo'])&& $this->post['pgNo']!="" ? trim($this->post['pgNo']):"";
  559. $use_desc = isset($this->post['use_desc'])&& $this->post['use_desc']!="" ? trim($this->post['use_desc']):"";
  560. if($use_desc==""){
  561. return error_show(1003,"参数use_desc不能为空");
  562. }
  563. $remark = isset($this->post['remark'])&& $this->post['remark']!="" ? trim($this->post['remark']):"";
  564. if($remark==""){
  565. return error_show(1003,"参数remark不能为空");
  566. }
  567. if($metal_id!=0){
  568. if($config==""){
  569. return error_show(1003,"参数config不能为空");
  570. }
  571. if($other_config==""){
  572. return error_show(1003,"参数other_config不能为空");
  573. }
  574. if($specs_weight===""){
  575. return error_show(1003,"参数specs_weight不能为空");
  576. }
  577. if($gold_price===""){
  578. return error_show(1003,"参数gold_price不能为空");
  579. }
  580. }
  581. $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
  582. if($token==''){
  583. return error_show(102,"参数token不能为空");
  584. }
  585. $user =GetUserInfo($token);
  586. if(empty($user)||$user['code']!=0){
  587. return error_show(105,"用户数据不存在");
  588. }
  589. $specinfo=[];
  590. foreach ($specin as $v){
  591. $spec =Db::name("specs")->where(["id"=>$v['specid']])->find();
  592. $spec_value =Db::name("spec_value")->where(["id"=>$v['spec_value_id']])->find();
  593. $v['spec_name']=isset($spec['spec_name'])?$spec['spec_name']:"";
  594. $v['spec_value_name']=isset($spec_value['spec_value'])?$spec_value['spec_value']:"";
  595. $specinfo[]=$v;
  596. }
  597. $createrid= isset($user["data"]['id']) ? $user["data"]['id'] : "";
  598. $creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
  599. $bidlist = Db::name("consult_bids")->where(["infoNo"=>$zxinfo['infoNo'],"is_del"=>0])->select();
  600. try{
  601. $innew =makeNo("INF");
  602. $info=[
  603. "infoNo"=>$innew,
  604. "zxNo"=>$zxinfo['zxNo'],
  605. "spuCode"=>"",
  606. "good_name"=>$good_name,
  607. "good_img"=>$good_img,
  608. "cat_id"=>$cat_id,
  609. "unit"=>$unit,
  610. "brand_id"=>$brand_id,
  611. "arrival_time"=>$arrival_time,
  612. "specinfo"=>json_encode($specinfo),
  613. // "color"=>$color,
  614. // "material"=>$material,
  615. "cost_desc"=>$cost_desc,
  616. "is_addrs"=>$is_addrs,
  617. "is_custom"=>$is_custom,
  618. "metal_id"=>$metal_id,
  619. "config"=>$config,
  620. "other_config"=>$other_config,
  621. "specs_weight"=>$specs_weight===""?0:$specs_weight,
  622. "gold_price"=>$gold_price===""? 0 : $gold_price,
  623. "is_gold_price"=>$is_gold_price===""?0:$is_gold_price,
  624. "total_weight"=>$total_weight===""? $num*$specs_weight :$total_weight,
  625. "budget_price"=>$budget_price,
  626. "num"=>$num,
  627. "pgNo"=>$pgNo,
  628. "use_desc"=>$use_desc,
  629. "remark"=>$remark,
  630. "status"=>1,
  631. "is_del"=>0,
  632. "addtime"=>date("Y-m-d H:i:s"),
  633. "updatetime"=>date("Y-m-d H:i:s")
  634. ];
  635. $up = Db::name("consult_info")->insert($info);
  636. if($up){
  637. if (!empty($bidlist)){
  638. foreach ($bidlist as $value){
  639. unset($value['id']);
  640. $value['infoNo']=$innew;
  641. $value['sale_price'] =$value['total_price'];
  642. $value['status'] =0;
  643. $value['updatetime'] =date("Y-m-d H:i:s");
  644. $in = Db::name("consult_bids")->insert($value);
  645. if($in==false){
  646. Db::rollback();
  647. return error_show(1004,"反馈商品新建失败");
  648. }
  649. }
  650. }
  651. $zxinfo["bargain_status"] =1;
  652. $zxinfo["bargain_code"] =$innew;
  653. $zxinfo["updatetime"] =date("Y-m-d H:i:s");
  654. $bar=Db::name("consult_info")->save($zxinfo);
  655. if($bar==false){
  656. Db::rollback();
  657. return error_show(1004,"反馈商品更新失败");
  658. }
  659. Db::commit();
  660. return app_show(0,"咨询新建成功",["infoNo"=>$innew]);
  661. }
  662. }catch (\Exception $e){
  663. Db::rollback();
  664. return error_show(1004,$e->getMessage());
  665. }
  666. }
  667. //** 发布竞标任务 */
  668. public function bargain(){
  669. $infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
  670. if($infoNo==""){
  671. return error_show(1004,"参数infoNo不能为空");
  672. }
  673. $zxinfo = Db::name("consult_info")->where(["infoNo"=>$infoNo,"is_del"=>0])->find();
  674. if($zxinfo==false){
  675. return error_show(1004,"未找到信息数据");
  676. }
  677. $status =isset($this->post['status']) && $this->post['status']!=="" ? intval($this->post['status']):"";
  678. if($status===""){
  679. return error_show(1004,"参数status不能为空");
  680. }
  681. if($status==1&&$zxinfo['status']>1){
  682. $zxinfo['bargain_num']=+1;
  683. }
  684. $zxinfo['status']=$status;
  685. $zxinfo['updatetime']=date("Y-m-d H:i:s");
  686. $up = Db::name("consult_info")->save($zxinfo);
  687. if($up){
  688. return app_show(0,"状态更新成功");
  689. }else{
  690. return error_show(1003,"状态更新失败");
  691. }
  692. }
  693. public function feadback(){
  694. $infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
  695. if($infoNo==""){
  696. return error_show(1002,"参数infoNo不能为空");
  697. }
  698. $zxinfo = Db::name("consult_info")->where(["infoNo"=>$infoNo,"is_del"=>0])->find();
  699. if($zxinfo==false){
  700. return error_show(1003,"未找到信息数据");
  701. }
  702. if($zxinfo['status']!=1){
  703. return error_show(1004,"任务未进行");
  704. }
  705. $pname = isset($this->post['pname'])&&$this->post['pname']!=""? trim($this->post['pname']):"";
  706. if($pname==""){
  707. return error_show(1002,"参数pname不能为空");
  708. }
  709. $brandid = isset($this->post['brandid'])&&$this->post['brandid']!=""? intval($this->post['brandid']):"";
  710. // if($brandid==""){
  711. // return error_show(1002,"参数brandid不能为空");
  712. // }
  713. $cat_id = isset($this->post['cat_id'])&&$this->post['cat_id']!=""? trim($this->post['cat_id']):"";
  714. if($cat_id==""){
  715. return error_show(1002,"参数cat_id不能为空");
  716. }
  717. $specin= isset($this->post['specinfo'])&&!empty($this->post['specinfo'])?$this->post['specinfo']:"";
  718. if($specin==""){
  719. return error_show(1003,"参数specinfo不能为空");
  720. }
  721. $specinfo=[];
  722. foreach ($specin as $v){
  723. $spec =Db::name("specs")->where(["id"=>$v['specid']])->find();
  724. $spec_value =Db::name("spec_value")->where(["id"=>$v['spec_value_id']])->find();
  725. $v['spec_name']=isset($spec['spec_name'])?$spec['spec_name']:"";
  726. $v['spec_value_name']=isset($spec_value['spec_value'])?$spec_value['spec_value']:"";
  727. $specinfo[]=$v;
  728. }
  729. // $model = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
  730. // //$unit = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
  731. // $material = isset($this->post['material'])&&$this->post['material']!=""? trim($this->post['material']):"";
  732. // $color = isset($this->post['color'])&&$this->post['color']!=""? trim($this->post['color']):"";
  733. $unit_id = isset($this->post['unit_id'])&&$this->post['unit_id']!=""? intval($this->post['unit_id']):"";
  734. $cost_desc = isset($this->post['cost_desc'])&&$this->post['cost_desc']!=""? trim($this->post['cost_desc']):"";
  735. $work_day = isset($this->post['work_day'])&&$this->post['work_day']!=""? intval($this->post['work_day']):"";
  736. $delivery_day = isset($this->post['delivery_day'])&&$this->post['delivery_day']!=""? intval($this->post['delivery_day']):"";
  737. $good_img = isset($this->post['good_img'])&&$this->post['good_img']!=""? trim($this->post['good_img']):"";
  738. $expire_day = isset($this->post['expire_day'])&&$this->post['expire_day']!=""? intval($this->post['expire_day'])
  739. :"";
  740. $origin_place = isset($this->post['origin_place'])&&$this->post['origin_place']!=""? trim($this->post['origin_place']):"";
  741. $supplierNo = isset($this->post['supplierNo'])&&$this->post['supplierNo']!=""? trim($this->post['supplierNo']):"";
  742. $pay_way = isset($this->post['pay_way'])&&$this->post['pay_way']!=""? intval($this->post['pay_way']):"";
  743. $tax = isset($this->post['tax'])&&$this->post['tax']!=""? trim($this->post['tax']):"";
  744. $send_way = isset($this->post['send_way'])&&$this->post['send_way']!=""? intval($this->post['send_way']):"";
  745. $metal_id = isset($this->post['metal_id'])&&$this->post['metal_id']!=""? intval($this->post['metal_id']):"";
  746. $is_gold_price = isset($this->post['is_gold_price'])&&$this->post['is_gold_price']!=""? intval($this->post['is_gold_price']):"";
  747. $config = isset($this->post['config'])&&$this->post['config']!=""? $this->post['config']:"";
  748. $weight = isset($this->post['weight'])&&$this->post['weight']!=""? floatval($this->post['weight']):"";
  749. $demo_fee = isset($this->post['demo_fee'])&&$this->post['demo_fee']!=""? floatval($this->post['demo_fee']):"";
  750. $delivery_fee = isset($this->post['delivery_fee'])&&$this->post['delivery_fee']!=""? floatval($this->post['delivery_fee']):"";
  751. $open_fee = isset($this->post['open_fee'])&&$this->post['open_fee']!=""? floatval($this->post['open_fee']):"";
  752. $pakge_fee = isset($this->post['pakge_fee'])&&$this->post['pakge_fee']!=""? floatval($this->post['pakge_fee']):"";
  753. $nake_fee = isset($this->post['nake_fee'])&&$this->post['nake_fee']!=""? floatval($this->post['nake_fee']):"";
  754. $mark_fee = isset($this->post['mark_fee'])&&$this->post['mark_fee']!=""? floatval($this->post['mark_fee']):"";
  755. $cert_fee = isset($this->post['cert_fee'])&&$this->post['cert_fee']!=""? floatval($this->post['cert_fee']):"";
  756. $cost_fee = isset($this->post['cost_fee'])&&$this->post['cost_fee']!=""? floatval($this->post['cost_fee']):"";
  757. $total_fee = isset($this->post['total_fee'])&&$this->post['total_fee']!=""? floatval($this->post['total_fee']):"";
  758. $is_diff = isset($this->post['is_diff'])&&$this->post['is_diff']!==""? intval($this->post['is_diff']):"";
  759. $supply_area = isset($this->post['supply_area'])&&$this->post['supply_area']!==""? intval($this->post['supply_area']):"";
  760. $remark = isset($this->post['remark'])&&$this->post['remark']!=""? trim($this->post['remark']):"";
  761. $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
  762. if($token==''){
  763. return error_show(1002,"参数token不能为空");
  764. }
  765. $user =GetUserInfo($token);
  766. if(empty($user)||$user['code']!=0){
  767. return error_show(1005,"用户数据不存在");
  768. }
  769. $createrid= isset($user["data"]['id']) ? $user["data"]['id'] : "";
  770. $creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
  771. $bidNo=makeNo("BD");
  772. $spucode=makeNo("SPU");
  773. $data=[
  774. "bidNo"=>$bidNo,
  775. "infoNo"=>$infoNo,
  776. "zxNo"=>$zxinfo['zxNo'],
  777. "spuCode"=>$spucode,
  778. "good_name"=>$pname,
  779. "brand_id"=>$brandid,
  780. "cat_id"=>$cat_id,
  781. "specinfo"=>json_encode($specinfo),
  782. // "color"=>$color,
  783. // "material"=>$material,
  784. "unit_id"=>$unit_id,
  785. "cost_desc"=>$cost_desc,
  786. "work_day"=>$work_day,
  787. "delivery_day"=>$delivery_day,
  788. "good_img"=>$good_img,
  789. "expire_day"=>$expire_day,
  790. "origin_place"=>$origin_place,
  791. "supplierNo"=>$supplierNo,
  792. "pay_way"=>$pay_way,
  793. "tax"=>$tax,
  794. "send_way"=>$send_way,
  795. "metal_id"=>$metal_id,
  796. "is_gold_price"=>$is_gold_price,
  797. "config"=>$config,
  798. "weight"=>$weight,
  799. "is_diff"=>$is_diff,
  800. "demo_fee"=>$demo_fee,
  801. "delivery_fee"=>$delivery_fee,
  802. "open_fee"=>$open_fee,
  803. "pakge_fee"=>$pakge_fee,
  804. "nake_fee"=>$nake_fee,
  805. "mark_fee"=>$mark_fee,
  806. "cert_fee"=>$cert_fee,
  807. "cost_fee"=>$cost_fee,
  808. "total_fee"=>$total_fee,
  809. "supply_area"=>$supply_area,
  810. "remark"=>$remark,
  811. "sale_price"=>0,
  812. "createrid"=>$createrid,
  813. "creater"=>$creater,
  814. "status"=>$zxinfo['status']==1 ?1 :2,
  815. "is_del"=>0,
  816. "addtime"=>date("Y-m-d H:i:s"),
  817. "updatetime"=>date("Y-m-d H:i:s")
  818. ];
  819. Db::startTrans();
  820. try{
  821. $insert= Db::name("consult_bids")->insert($data);
  822. if($insert){
  823. $data=[
  824. "spuCode"=>$spucode,
  825. "good_name"=>$pname,
  826. "brand_id"=>$brandid,
  827. "good_unit"=>$unit_id,
  828. "good_type"=>0,
  829. "moq"=>1,
  830. "customized"=>$work_day,
  831. "tax"=>$tax,
  832. "supplierNo"=>$supplierNo,
  833. "is_auth"=>0,
  834. "craft_desc"=>$cost_desc,
  835. "good_remark"=>$remark,
  836. "good_img"=>$good_img,
  837. "good_thumb_img"=>"",
  838. "good_info_img"=>"",
  839. "status"=>1,
  840. "is_del"=>0,
  841. "createrid"=>$createrid,
  842. "creater"=>$creater,
  843. "addtime"=>date("Y-m-d H:i:s"),
  844. "updatetime"=>date("Y-m-d H:i:s")
  845. ];
  846. $good = Db::name("good_zixun")->insert($data);
  847. if($good){
  848. Db::commit();
  849. return app_show(0,"反馈成功",["bidNo"=>$bidNo]);
  850. }else{
  851. Db::rollback();
  852. return error_show(1006,"反馈失败");
  853. }
  854. }else{
  855. Db::rollback();
  856. return error_show(1006,"反馈失败");
  857. }
  858. }catch (\Exception $e){
  859. Db::rollback();
  860. return error_show(1006,$e->getMessage());
  861. }
  862. }
  863. public function feadinfo(){
  864. $bidNo =isset($this->post['bidNo'])&& $this->post['bidNo']!=""?trim($this->post['bidNo']):"";
  865. if($bidNo==""){
  866. return error_show(1004,"参数bidNo不能为空");
  867. }
  868. $info =Db::name("consult_bids")->where(['bidNo'=>$bidNo,"is_del"=>0])->find();
  869. if($info==false){
  870. return error_show(1004,"未找到商品数据");
  871. }
  872. $unit =Db::name("unit")->where(["id"=>$info['unit_id']])->find();
  873. $info['unit'] = isset($unit['unit'])?$unit['unit']:'';
  874. $info['cat_info'] = made($info['cat_id'],[]);
  875. $supplier = Db::name("supplier")->where(["code"=>$info['supplierNo']])->find();
  876. $info['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
  877. if($info['brand_id']!=0){
  878. $brand=Db::name("brand")->where(["id"=>$info['brand_id']])->find();
  879. $info["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
  880. }else{
  881. $info["brand_name"]="";
  882. $info["brand_id"]="";
  883. }
  884. $catinfo = Db::name("cat")->where(["id"=>$info['cat_id']])->find();
  885. $bidinfo = Db::name("consult_info")->where(["infoNo"=>$info["infoNo"]])->find();
  886. $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:100;
  887. $god=[
  888. "metal_id"=>$info['metal_id'],
  889. "weight"=>$info["weight"],
  890. "demo_fee"=>$info["demo_fee"],
  891. "delivery_fee"=>$info["delivery_fee"],
  892. "open_fee"=>$info["open_fee"],
  893. "packing_fee"=>$info["pakge_fee"],
  894. "mark_fee"=>$info["mark_fee"],
  895. "nake_fee"=>$info["nake_fee"],
  896. "cert_fee"=>$info["cert_fee"],
  897. "cost_fee"=>$info["cost_fee"],
  898. "num"=>$bidinfo["num"],
  899. ];
  900. if($info['is_gold_price']==1){
  901. $price = GoldPrice($god, $budget/100);
  902. }else{
  903. $price = GoodPrice($god, $budget/100);
  904. }
  905. $info['specinfo'] = json_decode($info['specinfo'],true);
  906. $info['sale_price'] =round($price,2);
  907. $bargain =Db::name("bargain_order")->where(['bidsNo'=>$bidNo,"is_del"=>0])->find();
  908. $info['bargain'] =$bargain;
  909. return app_show(0,"获取成功",$info);
  910. }
  911. public function feededit(){
  912. $bidNo= isset($this->post['bidNo'])&&$this->post['bidNo']!=""?trim($this->post['bidNo']):"";
  913. if($bidNo==""){
  914. return error_show(1002,"参数bidNo不能为空");
  915. }
  916. $bidinfo = Db::name("consult_bids")->where(["bidNo"=>$bidNo,"is_del"=>0])->find();
  917. if($bidinfo==false){
  918. return error_show(1003,"未找到信息数据");
  919. }
  920. if($bidinfo['status']>=5){
  921. return error_show(1004,"咨询单已确认无法修改");
  922. }
  923. $zxinfo = Db::name("consult_info")->where(["infoNo"=>$bidinfo['infoNo'],"is_del"=>0])->find();
  924. if($zxinfo==false){
  925. return error_show(1003,"未找到信息数据");
  926. }
  927. $pname = isset($this->post['pname'])&&$this->post['pname']!=""? trim($this->post['pname']):"";
  928. if($pname==""){
  929. return error_show(1002,"参数pname不能为空");
  930. }
  931. $brandid = isset($this->post['brandid'])&&$this->post['brandid']!=""? intval($this->post['brandid']):"";
  932. // if($brandid==""){
  933. // return error_show(1002,"参数brandid不能为空");
  934. // }
  935. $cat_id = isset($this->post['cat_id'])&&$this->post['cat_id']!=""? trim($this->post['cat_id']):"";
  936. if($cat_id==""){
  937. return error_show(1002,"参数cat_id不能为空");
  938. }
  939. $specin= isset($this->post['specinfo'])&&!empty($this->post['specinfo'])?$this->post['specinfo']:"";
  940. if($specin==""){
  941. return error_show(1003,"参数specinfo不能为空");
  942. }
  943. $specinfo=[];
  944. foreach ($specin as $v){
  945. $spec =Db::name("specs")->where(["id"=>$v['specid']])->find();
  946. $spec_value =Db::name("spec_value")->where(["id"=>$v['spec_value_id']])->find();
  947. $v['spec_name']=isset($spec['spec_name'])?$spec['spec_name']:"";
  948. $v['spec_value_name']=isset($spec_value['spec_value'])?$spec_value['spec_value']:"";
  949. $specinfo[]=$v;
  950. }
  951. $unit_id = isset($this->post['unit_id'])&&$this->post['unit_id']!=""? intval($this->post['unit_id']):"";
  952. $cost_desc = isset($this->post['cost_desc'])&&$this->post['cost_desc']!=""? trim($this->post['cost_desc']):"";
  953. $work_day = isset($this->post['work_day'])&&$this->post['work_day']!=""? intval($this->post['work_day']):"";
  954. $delivery_day = isset($this->post['delivery_day'])&&$this->post['delivery_day']!=""? intval($this->post['delivery_day']):"";
  955. $good_img = isset($this->post['good_img'])&&$this->post['good_img']!=""? trim($this->post['good_img']):"";
  956. $expire_day = isset($this->post['expire_day'])&&$this->post['expire_day']!=""? intval($this->post['expire_day'])
  957. :"";
  958. $origin_place = isset($this->post['origin_place'])&&$this->post['origin_place']!=""? trim($this->post['origin_place']):"";
  959. $supplierNo = isset($this->post['supplierNo'])&&$this->post['supplierNo']!=""? trim($this->post['supplierNo']):"";
  960. $pay_way = isset($this->post['pay_way'])&&$this->post['pay_way']!=""? intval($this->post['pay_way']):"";
  961. $tax = isset($this->post['tax'])&&$this->post['tax']!=""? trim($this->post['tax']):"";
  962. $send_way = isset($this->post['send_way'])&&$this->post['send_way']!=""? intval($this->post['send_way']):"";
  963. $metal_id = isset($this->post['metal_id'])&&$this->post['metal_id']!=""? intval($this->post['metal_id']):"";
  964. $is_gold_price = isset($this->post['is_gold_price'])&&$this->post['is_gold_price']!=""? intval($this->post['is_gold_price']):"";
  965. $config = isset($this->post['config'])&&$this->post['config']!=""? $this->post['config']:"";
  966. $weight = isset($this->post['weight'])&&$this->post['weight']!=""? floatval($this->post['weight']):"";
  967. $demo_fee = isset($this->post['demo_fee'])&&$this->post['demo_fee']!=""? floatval($this->post['demo_fee']):"";
  968. $delivery_fee = isset($this->post['delivery_fee'])&&$this->post['delivery_fee']!=""? floatval($this->post['delivery_fee']):"";
  969. $open_fee = isset($this->post['open_fee'])&&$this->post['open_fee']!=""? floatval($this->post['open_fee']):"";
  970. $pakge_fee = isset($this->post['pakge_fee'])&&$this->post['pakge_fee']!=""? floatval($this->post['pakge_fee']):"";
  971. $nake_fee = isset($this->post['nake_fee'])&&$this->post['nake_fee']!=""? floatval($this->post['nake_fee']):"";
  972. $mark_fee = isset($this->post['mark_fee'])&&$this->post['mark_fee']!=""? floatval($this->post['mark_fee']):"";
  973. $cert_fee = isset($this->post['cert_fee'])&&$this->post['cert_fee']!=""? floatval($this->post['cert_fee']):"";
  974. $cost_fee = isset($this->post['cost_fee'])&&$this->post['cost_fee']!=""? floatval($this->post['cost_fee']):"";
  975. $total_fee = isset($this->post['total_fee'])&&$this->post['total_fee']!=""? floatval($this->post['total_fee']):"";
  976. $is_diff = isset($this->post['is_diff'])&&$this->post['is_diff']!==""? intval($this->post['is_diff']):"";
  977. $supply_area = isset($this->post['supply_area'])&&$this->post['supply_area']!==""? intval($this->post['supply_area']):"";
  978. $remark = isset($this->post['remark'])&&$this->post['remark']!=""? trim($this->post['remark']):"";
  979. $data=[
  980. "good_name"=>$pname,
  981. "brand_id"=>$brandid,
  982. "cat_id"=>$cat_id,
  983. "specinfo"=>json_encode($specinfo),
  984. // "material"=>$material,
  985. "unit_id"=>$unit_id,
  986. "cost_desc"=>$cost_desc,
  987. "work_day"=>$work_day,
  988. "delivery_day"=>$delivery_day,
  989. "good_img"=>$good_img,
  990. "expire_day"=>$expire_day,
  991. "origin_place"=>$origin_place,
  992. "supplierNo"=>$supplierNo,
  993. "pay_way"=>$pay_way,
  994. "tax"=>$tax,
  995. "send_way"=>$send_way,
  996. "metal_id"=>$metal_id,
  997. "is_gold_price"=>$is_gold_price,
  998. "config"=>$config,
  999. "weight"=>$weight,
  1000. "is_diff"=>$is_diff,
  1001. "demo_fee"=>$demo_fee,
  1002. "delivery_fee"=>$delivery_fee,
  1003. "open_fee"=>$open_fee,
  1004. "pakge_fee"=>$pakge_fee,
  1005. "nake_fee"=>$nake_fee,
  1006. "mark_fee"=>$mark_fee,
  1007. "cert_fee"=>$cert_fee,
  1008. "cost_fee"=>$cost_fee,
  1009. "total_fee"=>$total_fee,
  1010. "supply_area"=>$supply_area,
  1011. "remark"=>$remark,
  1012. "updatetime"=>date("Y-m-d H:i:s")
  1013. ];
  1014. $insert= Db::name("consult_bids")->where($bidinfo)->save($data);
  1015. if($insert){
  1016. return app_show(0,"编辑成功");
  1017. }else{
  1018. return error_show(1004,"编辑失败");
  1019. }
  1020. }
  1021. public function bargain_add(){
  1022. $bidNo = isset($this->post['bidNo'])&& $this->post['bidNo']!=""?trim($this->post['bidNo']):"";
  1023. if($bidNo===""){
  1024. return error_show(1004,"参数bidNo不能为空");
  1025. }
  1026. $info =Db::name("consult_bids")->where(['bidNo'=>$bidNo,"is_del"=>0])->find();
  1027. if($info==false){
  1028. return error_show(1004,"未找到商品数据");
  1029. }
  1030. $infos =Db::name("consult_info")->where(['infoNo'=>$info['infoNo'],"is_del"=>0])->find();
  1031. if($infos==false){
  1032. return error_show(1004,"未找到商品数据");
  1033. }
  1034. $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
  1035. if($token==''){
  1036. return error_show(1005,"参数token不能为空");
  1037. }
  1038. $user =GetUserInfo($token);
  1039. if(empty($user)||$user['code']!=0){
  1040. return error_show(1002,"用户数据不存在");
  1041. }
  1042. $createrid= isset($user["data"]['id']) ? $user["data"]['id'] : "";
  1043. $creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
  1044. $bargainNo =makeNo("BAR");
  1045. Db::startTrans();
  1046. try{
  1047. $data=[
  1048. "bidsNo"=>$bidNo,
  1049. "bargainNo"=>$bargainNo,
  1050. "bargain_type"=>1,
  1051. "sale_price"=>$info['sale_price'],
  1052. "cost_before_price"=>$info['cost_fee'],
  1053. "cost_after_price"=>$info['cost_fee'],
  1054. "before_rate"=>$info['cost_fee'],
  1055. "after_rate"=>$info['cost_fee'],
  1056. "after_price"=>$infos['budget_price'],
  1057. "status"=>1,
  1058. "is_del"=>0,
  1059. "creater"=>$creater,
  1060. "createrid"=>$createrid,
  1061. "addtime"=>date("Y-m-d H:i:s"),
  1062. "updatetime"=>date("Y-m-d H:i:s")
  1063. ];
  1064. $int = Db::name("bargain_order")->insert($data);
  1065. if($int){
  1066. $info['status']=3;
  1067. $info['updatetime']=date("Y-m-d H:i:s");
  1068. $up =Db::name("consult_bids")->save($info);
  1069. if($up){
  1070. Db::commit();
  1071. return app_show(0,"议价单生成成功",["bargainNo"=>$bargainNo]);
  1072. }
  1073. }
  1074. }catch (\Exception $e){
  1075. Db::rollback();
  1076. return error_show(1004,$e->getMessage());
  1077. }
  1078. }
  1079. public function bargain_status(){
  1080. $bargainNo = isset($this->post['bargainNo'])&& $this->post['bargainNo']!=""?trim($this->post['bargainNo']):"";
  1081. if($bargainNo===""){
  1082. return error_show(1004,"参数bargainNo不能为空");
  1083. }
  1084. $info =Db::name("bargain_order")->where(['bargainNo'=>$bargainNo,"is_del"=>0])->find();
  1085. if($info==false){
  1086. return error_show(1004,"未找到议价数据");
  1087. }
  1088. $bids=Db::name("consult_bids")->where(["bidNo"=>$info["bidsNo"],"is_del"=>0])->find();
  1089. if($bids==false){
  1090. return error_show(1004,"未找到商品数据");
  1091. }
  1092. $status = isset($this->post['status'])&& $this->post['status']!=='' ? intval($this->post['status']):"";
  1093. if($status==''){
  1094. return error_show(1005,"参数status不能为空");
  1095. }
  1096. Db::startTrans();
  1097. try{
  1098. $info['status'] =$status;
  1099. $info['updatetime'] =date("Y-m-d H:i:s");
  1100. $up =Db::name("bargain_order")->save($info);
  1101. if($up){
  1102. if($status==4){
  1103. $bids['status']=4;
  1104. $bids['sale_price']=$info['after_price'];
  1105. $bids['updatetime']=date("Y-m-d H:i:s");
  1106. $up =Db::name("consult_bids")->save($bids);
  1107. if($up==false){
  1108. Db::rollback();
  1109. return error_show(1004,"数据更新失败");
  1110. }
  1111. }
  1112. if($status==5||$status==6||$status==7){
  1113. $bids['status']=4;
  1114. $bids['updatetime']=date("Y-m-d H:i:s");
  1115. $up =Db::name("consult_bids")->save($bids);
  1116. if($up==false){
  1117. Db::rollback();
  1118. return error_show(1004,"数据更新失败");
  1119. }
  1120. }
  1121. Db::commit();
  1122. return app_show(0,"更新成功");
  1123. }
  1124. }catch (\Exception $e){
  1125. Db::rollback();
  1126. return error_show(1004,$e->getMessage());
  1127. }
  1128. }
  1129. public function bargain_info(){
  1130. $bargainNo = isset($this->post['bargainNo'])&& $this->post['bargainNo']!=""?trim($this->post['bargainNo']):"";
  1131. if($bargainNo===""){
  1132. return error_show(1004,"参数bargainNo不能为空");
  1133. }
  1134. $info =Db::name("bargain_order")->where(['bargainNo'=>$bargainNo,"is_del"=>0])->find();
  1135. if($info==false){
  1136. return error_show(1004,"未找到议价数据");
  1137. }
  1138. return app_show(0,"获取成功",$info);
  1139. }
  1140. public function bidlist(){
  1141. $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
  1142. $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) :"10";
  1143. $where=[['is_del',"=",0]];
  1144. $zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
  1145. if ($zxNo !== "") {
  1146. $where[] = ['zxNo','=',$zxNo];
  1147. }
  1148. $infoNo = isset($this->post['infoNo']) && $this->post['infoNo'] !== "" ? trim($this->post['infoNo']) : "";
  1149. if ($infoNo !== "") {
  1150. $where[] = ['infoNo','=',$infoNo];
  1151. }
  1152. $bidNo = isset($this->post['bidNo']) && $this->post['bidNo'] !== "" ? trim($this->post['bidNo']) : "";
  1153. if ($bidNo !== "") {
  1154. $where[] = ['bidNo','=',$bidNo];
  1155. }
  1156. $pgNo = isset($this->post['pgNo']) && $this->post['pgNo'] !== "" ? trim($this->post['pgNo']) : "";
  1157. if ($pgNo !== "") {
  1158. $bidinfo = Db::name("consult_info")->where([["pgNo","=",$pgNo],["is_del","=",0]])->column("infoNo");
  1159. $where[] = ['infoNo','in',$bidinfo];
  1160. }
  1161. $bargain_status = isset($this->post['bargain_status']) && $this->post['bargain_status'] !== "" ? intval($this->post['bargain_status']) : "";
  1162. if ($bargain_status !== "") {
  1163. $bidinfo = Db::name("consult_info")->where([["bargain_status","=",$bargain_status],["is_del","=",0]])->column("infoNo");
  1164. $where[] = ['infoNo','in',$bidinfo];
  1165. }
  1166. $projectNo = isset($this->post['projectNo']) && $this->post['projectNo'] !== "" ? trim($this->post['projectNo']) : "";
  1167. if ($projectNo !== "") {
  1168. $zxlist = Db::name("consult_order")->where(["projectNo"=>$projectNo,"is_del"=>0,"is_project"=>1])->column
  1169. ("zxNo");
  1170. $where[] = ['zxNo','in',$zxlist];
  1171. }
  1172. $count = Db::name('consult_bids')->where($where)->count();
  1173. $total = ceil($count / $size);
  1174. $page = $page >= $total ? $total : $page;
  1175. $list =Db::name('consult_bids')->where($where)->page($page,$size)->select();
  1176. $data=[];
  1177. foreach ($list as $value){
  1178. $catinfo = Db::name("cat")->where(["id"=>$value['cat_id']])->find();
  1179. $value['can']= isset($value['cat_id']) && $value['cat_id'] !=0 ? made($value['cat_id']):[];
  1180. $unit =Db::name("unit")->where(["id"=>$value['unit_id']])->find();
  1181. $value['unit'] = isset($unit['unit'])?$unit['unit']:'';
  1182. $supplier = Db::name("supplier")->where(["code"=>$value['supplierNo']])->find();
  1183. $value['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
  1184. if($value['brand_id']!=0){
  1185. $brand=Db::name("brand")->where(["id"=>$value['brand_id']])->find();
  1186. $value["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
  1187. }else{
  1188. $value["brand_name"]="";
  1189. $value["brand_id"]="";
  1190. }
  1191. $bidinfo = Db::name("consult_info")->where(["infoNo"=>$value["infoNo"]])->find();
  1192. $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:100;
  1193. $god=[
  1194. "metal_id"=>$value['metal_id'],
  1195. "weight"=>$value["weight"],
  1196. "demo_fee"=>$value["demo_fee"],
  1197. "delivery_fee"=>$value["delivery_fee"],
  1198. "open_fee"=>$value["open_fee"],
  1199. "packing_fee"=>$value["pakge_fee"],
  1200. "mark_fee"=>$value["mark_fee"],
  1201. "nake_fee"=>$value["nake_fee"],
  1202. "cert_fee"=>$value["cert_fee"],
  1203. "cost_fee"=>$value["cost_fee"],
  1204. "num"=>$bidinfo["num"],
  1205. ];
  1206. if($value['is_gold_price']==1){
  1207. $price = GoldPrice($god, $budget/100);
  1208. }else{
  1209. $price = GoodPrice($god, $budget/100);
  1210. }
  1211. $value['specinfo'] = json_decode($value['specinfo'],true);
  1212. $value['sale_price'] =round($price,2);
  1213. $value['bargain_status']=$bidinfo['bargain_status'];
  1214. $data[]=$value;
  1215. }
  1216. return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
  1217. }
  1218. public function feedlist(){
  1219. $where=[['is_del',"=",0]];
  1220. $zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
  1221. if ($zxNo !== "") {
  1222. $where[] = ['zxNo','=',$zxNo];
  1223. }
  1224. $infoNo = isset($this->post['infoNo']) && $this->post['infoNo'] !== "" ? trim($this->post['infoNo']) : "";
  1225. if ($infoNo !== "") {
  1226. $where[] = ['infoNo','=',$infoNo];
  1227. }
  1228. $bidNo = isset($this->post['bidNo']) && $this->post['bidNo'] !== "" ? trim($this->post['bidNo']) : "";
  1229. if ($bidNo !== "") {
  1230. $where[] = ['bidNo','=',$bidNo];
  1231. }
  1232. $projectNo = isset($this->post['projectNo']) && $this->post['projectNo'] !== "" ? trim($this->post['projectNo']) : "";
  1233. if ($projectNo !== "") {
  1234. $zxlist = Db::name("consult_order")->where(["projectNo"=>$projectNo,"is_del"=>0,"is_project"=>1])->column
  1235. ("zxNo");
  1236. $where[] = ['zxNo','in',$zxlist];
  1237. }
  1238. $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
  1239. if($token==''){
  1240. return error_show(102,"参数token不能为空");
  1241. }
  1242. $user =GetUserInfo($token);
  1243. if(empty($user)||$user['code']!=0){
  1244. return error_show(105,"用户数据不存在");
  1245. }
  1246. $createrid= isset($user["data"]['id']) ? $user["data"]['id'] : "";
  1247. $creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
  1248. $where[] = ["createrid","=",$createrid];
  1249. $list =Db::name('consult_bids')->where($where)->select();
  1250. $data=[];
  1251. foreach ($list as $value){
  1252. $catinfo = Db::name("cat")->where(["id"=>$value['cat_id']])->find();
  1253. $value['can']= isset($value['cat_id']) && $value['cat_id'] !=0 ? made($value['cat_id']):[];
  1254. $unit =Db::name("unit")->where(["id"=>$value['unit_id']])->find();
  1255. $value['unit'] = isset($unit['unit'])?$unit['unit']:'';
  1256. $supplier = Db::name("supplier")->where(["code"=>$value['supplierNo']])->find();
  1257. $value['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
  1258. if($value['brand_id']!=0){
  1259. $brand=Db::name("brand")->where(["id"=>$value['brand_id']])->find();
  1260. $value["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
  1261. }else{
  1262. $value["brand_name"]="";
  1263. $value["brand_id"]="";
  1264. }
  1265. $bidinfo = Db::name("consult_info")->where(["infoNo"=>$value["infoNo"]])->find();
  1266. $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:100;
  1267. $god=[
  1268. "metal_id"=>$value['metal_id'],
  1269. "weight"=>$value["weight"],
  1270. "demo_fee"=>$value["demo_fee"],
  1271. "delivery_fee"=>$value["delivery_fee"],
  1272. "open_fee"=>$value["open_fee"],
  1273. "packing_fee"=>$value["pakge_fee"],
  1274. "mark_fee"=>$value["mark_fee"],
  1275. "nake_fee"=>$value["nake_fee"],
  1276. "cert_fee"=>$value["cert_fee"],
  1277. "cost_fee"=>$value["cost_fee"],
  1278. "num"=>$bidinfo["num"],
  1279. ];
  1280. if($value['is_gold_price']==1){
  1281. $price = GoldPrice($god, $budget/100);
  1282. }else{
  1283. $price = GoodPrice($god, $budget/100);
  1284. }
  1285. $value['sale_price'] =round($price,2);
  1286. $value['specinfo'] = json_decode($value['specinfo'],true);
  1287. $value['bargain_status']=$bidinfo['bargain_status'];
  1288. $data[]=$value;
  1289. }
  1290. return app_show(0,"获取成功",$data);
  1291. }
  1292. }