Contract.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018-2020 rights reserved.
  6. // +----------------------------------------------------------------------
  7. // |
  8. // +----------------------------------------------------------------------
  9. // | Date: 2020-08-31 20:43
  10. // +----------------------------------------------------------------------
  11. namespace app\system\controller;
  12. use app\BaseController;
  13. use app\lib\OrderLib;
  14. use app\model\api\ArticleModel;
  15. use app\model\api\InfoAudit;
  16. use app\model\api\PayTrade;
  17. use library\utils\WxpayV2 as wxpayApi;
  18. use app\model\api\User as UserModel;
  19. use app\model\api\ContractRecord as UserContractRecordModel;
  20. use app\model\api\UserClock as UserClockModel;
  21. use app\model\api\ContractComment as ContractCommentModel;
  22. use app\model\api\UserDetail as UserDetailModel;
  23. use app\model\api\UserScoreDetail as UserScoreDetailModel;
  24. use app\model\api\UserShowTemplate;
  25. use library\services\UtilService;
  26. use app\Request;
  27. use think\facade\Db;
  28. class Contract extends BaseController
  29. {
  30. /**
  31. * 合同列表
  32. * @param Request $request
  33. * @return
  34. */
  35. public function ContractRecordList(Request $request)
  36. {
  37. $pageSize = 50;
  38. $post = UtilService::getMore(
  39. [
  40. ['page', 1],
  41. ['uid',''], //甲方uid
  42. ['name',''], //甲方姓名
  43. ['phone',''], //甲方电话
  44. ['to_uid',''], //乙方uid
  45. ['to_name',''], //乙方姓名
  46. ['to_phone',''], //乙方电话
  47. ['contract_id', ''], //订单id
  48. ['contract_no', ''], //订单编号
  49. ['status',''],//状态 0未确认 1已签约 2已到期 -1取消签约
  50. ['time',[]],
  51. ], $request
  52. );
  53. $where = [];
  54. if(!empty($post['uid'])){
  55. $where[]=["uid","=",$post['uid']];
  56. }
  57. if(!empty($post['name'])){
  58. $where[]=["name","like","%{$post["name"]}%"];
  59. }
  60. if(!empty($post['phone'])){
  61. $where[]=["phone","=",$post['phone']];
  62. }
  63. // else
  64. // if(!empty($post['mobile'])){
  65. // $m = Db::name("user")->where("mobile",$post['mobile'])->find();
  66. // if(!empty($m)) {
  67. // $where[]=["o.uid","=",$m['uid']];
  68. // }
  69. // }
  70. if(!empty($post['to_uid'])){
  71. $where[]=["to_uid","=",$post['to_uid']];
  72. }
  73. if(!empty($post['to_name'])){
  74. $where[]=["to_name","like","%{$post["to_name"]}%"];
  75. }
  76. if(!empty($post['to_phone'])){
  77. $where[]=["to_phone","=",$post['to_phone']];
  78. }
  79. if(!empty($post['contract_no'])){
  80. $where[]=["contract_no","like","%{$post["contract_no"]}%"];
  81. }
  82. if(!empty($post['contract_id'])){
  83. $where[]=["contract_id","=",$post['contract_id']];
  84. }
  85. if(!empty($post['status'])){
  86. $where[]=["status","=",$post['status']];
  87. }
  88. // if(in_array((string)$post['status'],["0","1","-1"])){
  89. // $where[]=["status","=",(int)$post['status']];
  90. // }
  91. //创建时间
  92. $startTime="";
  93. $endTime="";
  94. if(!empty($post['time'][0]) && !empty($post['time'][1])) {
  95. $startTime = strtotime($post['time'][0]);
  96. $endTime = strtotime($post['time'][1]);
  97. $where[]=["check_time","between","{$startTime},{$endTime}"];
  98. }
  99. $order = new UserContractRecordModel();
  100. $data = $order
  101. // ->alias("o")
  102. // ->field("*,u1.mobile,u1.nickname,a.title as show_template_title,a.imgs as show_template_imgs")
  103. // ->leftJoin("user u1","u1.uid = uid")
  104. // ->leftJoin("show_template a","a.id = show_template_id")
  105. ->field('*')
  106. ->where($where)
  107. ->page((int)$post["page"], $pageSize)
  108. ->order("id","desc")
  109. ->select()
  110. ->toArray();
  111. $pageCount = $order->where($where)->count();
  112. $result = UtilService::getParam([
  113. "id",
  114. "contract_no",
  115. "uid",
  116. "name",
  117. "phone",
  118. "address",
  119. "card",
  120. "to_uid",
  121. "to_name",
  122. "to_phone",
  123. "to_address",
  124. "to_card",
  125. "status",
  126. "from_check",
  127. "to_check",
  128. "uid_img",
  129. "to_uid_img",
  130. "price",
  131. "deposit",
  132. "balance",
  133. "content",
  134. "period",
  135. "mark",
  136. // "template_id",
  137. "start_time",
  138. "end_time",
  139. "create_time",
  140. "delete_time",
  141. "check_time",
  142. "longitude",
  143. "latitude"
  144. // ['start_time', 'start_time', function ($item) {
  145. // return empty($item) ? "-" : date('Y-m-d H:i:s', $item);
  146. // }],
  147. // ['end_time', 'end_time', function ($item) {
  148. // return empty($item) ? "-" : date('Y-m-d H:i:s', $item);
  149. // }],
  150. // ['create_time', 'create_time', function ($item) {
  151. // return empty($item) ? "-" : date('Y-m-d H:i:s', $item);
  152. // }],
  153. // ['delete_time', 'delete_time', function ($item) {
  154. // return empty($item) ? "-" : date('Y-m-d H:i:s', $item);
  155. // }],
  156. // ['check_time', 'check_time', function ($item) {
  157. // return empty($item) ? "-" : date('Y-m-d H:i:s', $item);
  158. // }],
  159. ], $data);
  160. return app('json')->success([
  161. 'list' => $result,
  162. 'pageCount' => $pageCount,
  163. 'pageSize' => $pageSize,
  164. 'page' => $post['page'],
  165. ]);
  166. }
  167. /**
  168. * 合约详细
  169. * @param Request $request
  170. * @return mixed
  171. */
  172. public function getContractInfo(Request $request) {
  173. [$id] = UtilService::getMore([
  174. ['id','']
  175. ],$request,true);
  176. $adminInfo = UserContractRecordModel::where("id",$id)->find()->toArray();
  177. return app('json')->success([
  178. 'id' => $id,
  179. 'contract_no' =>$adminInfo['contract_no'],
  180. 'uid' => $adminInfo['uid'],
  181. 'name' =>$adminInfo['name'],
  182. 'phone' => $adminInfo['phone'],
  183. 'address' => $adminInfo['address'],
  184. 'card' =>$adminInfo['card'],
  185. 'to_uid' => $adminInfo['to_uid'],
  186. 'to_name' =>$adminInfo['to_name'],
  187. 'to_phone' => $adminInfo['to_phone'],
  188. 'to_address' => $adminInfo['to_address'],
  189. 'to_card' => $adminInfo['to_card'],
  190. 'status' => $adminInfo['status'],
  191. 'from_check' => $adminInfo['from_check'],
  192. 'to_check' => $adminInfo['to_check'],
  193. 'uid_img' => $adminInfo['uid_img'],
  194. 'to_uid_img' => $adminInfo['to_uid_img'],
  195. 'price' => $adminInfo['price'],
  196. 'deposit' => $adminInfo['deposit'],
  197. 'balance' => $adminInfo['balance'],
  198. 'content' => $adminInfo['content'],
  199. 'period' => $adminInfo['period'],
  200. 'mark' => $adminInfo['mark'],
  201. 'start_time' =>$adminInfo['start_time'],
  202. 'end_time' =>$adminInfo['end_time'],
  203. 'create_time' =>$adminInfo['create_time'],
  204. 'delete_time' =>$adminInfo['delete_time'],
  205. 'check_time' =>$adminInfo['check_time'],
  206. 'longitude' =>$adminInfo['longitude'],
  207. 'latitude' => $adminInfo['latitude'],
  208. // 'start_time' => date('Y-m-d H:i:s', $adminInfo['start_time']),
  209. // 'end_time' => date('Y-m-d H:i:s', $adminInfo['end_time']),
  210. // 'create_time' => date('Y-m-d H:i:s', $adminInfo['create_time']),
  211. // 'delete_time' => date('Y-m-d H:i:s', $adminInfo['delete_time']),
  212. // 'check_time' => date('Y-m-d H:i:s', $adminInfo['check_time']),
  213. // 'template_id' => $adminInfo['template_id'],
  214. ]);
  215. }
  216. /**
  217. * 打卡列表
  218. * @param Request $request
  219. */
  220. public function UserClockList(Request $request)
  221. {
  222. $pageSize = 50;
  223. $post = UtilService::getMore(
  224. [
  225. ['page', 1],
  226. ['uid',0], //员工uid
  227. ['nickname',''], //员工名
  228. ['contract_id', ''], //签约id
  229. ['time',[]],
  230. ], $request
  231. );
  232. $where = [];
  233. if(!empty($post['uid'])){
  234. $where[]=["uid","=",$post['uid']];
  235. }
  236. // else
  237. // if(!empty($post['mobile'])){
  238. // $m = Db::name("user")->where("mobile",$post['mobile'])->find();
  239. // if(!empty($m)) {
  240. // $where[]=["o.uid","=",$m['uid']];
  241. // }
  242. // }
  243. if(!empty($post['nickname'])){
  244. $where[]=["nickname","like","%{$post["name"]}%"];
  245. }
  246. if(!empty($post['contract_id'])){
  247. $where[]=["contract_id","=",$post['contract_id']];
  248. }
  249. //创建时间
  250. $startTime="";
  251. $endTime="";
  252. if(!empty($post['time'][0]) && !empty($post['time'][1])) {
  253. $startTime = strtotime($post['time'][0]);
  254. $endTime = strtotime($post['time'][1]);
  255. $where[]=["create_time","between","{$startTime},{$endTime}"];
  256. }
  257. $order = new UserClockModel;
  258. $data = $order
  259. // ->alias("o")
  260. // ->field("*,u1.mobile,u1.nickname,a.title as show_template_title,a.imgs as show_template_imgs")
  261. // ->leftJoin("user u1","u1.uid = uid")
  262. // ->leftJoin("show_template a","a.id = show_template_id")
  263. ->field('*')
  264. ->where($where)
  265. ->page((int)$post["page"], $pageSize)
  266. ->order("id","desc")
  267. ->select()
  268. ->toArray();
  269. $pageCount = $order->where($where)->count();
  270. $result = UtilService::getParam([
  271. "id",
  272. "uid",
  273. "nickname",
  274. "contract_id",
  275. "longitude",
  276. "latitude",
  277. "content",
  278. "create_time"
  279. // ['create_time', 'create_time', function ($item) {
  280. // return empty($item) ? "-" : date('Y-m-d H:i:s', $item);
  281. // }],
  282. ], $data);
  283. return app('json')->success([
  284. 'list' => $result,
  285. 'pageCount' => $pageCount,
  286. 'pageSize' => $pageSize,
  287. 'page' => $post['page'],
  288. ]);
  289. }
  290. /**
  291. * 评价列表
  292. * @param Request $request
  293. */
  294. public function contractCommentList(Request $request)
  295. {
  296. $pageSize = 50;
  297. $post = UtilService::getMore(
  298. [
  299. ['page', 1],
  300. ['uid',0], //甲方
  301. ['to_uid',''], //乙方
  302. ['contract_id', ''], //签约id
  303. ['contract_no', ''], //签约编号
  304. ['time',[]],
  305. ], $request
  306. );
  307. $where = [];
  308. if(!empty($post['uid'])){
  309. $where[]=["uid","=",$post['uid']];
  310. }
  311. // else
  312. // if(!empty($post['mobile'])){
  313. // $m = Db::name("user")->where("mobile",$post['mobile'])->find();
  314. // if(!empty($m)) {
  315. // $where[]=["o.uid","=",$m['uid']];
  316. // }
  317. // }
  318. if(!empty($post['nickname'])){
  319. $where[]=["nickname","like","%{$post["name"]}%"];
  320. }
  321. if(!empty($post['contract_id'])){
  322. $where[]=["contract_id","=",$post['contract_id']];
  323. }
  324. //创建时间
  325. $startTime="";
  326. $endTime="";
  327. if(!empty($post['time'][0]) && !empty($post['time'][1])) {
  328. $startTime = strtotime($post['time'][0]);
  329. $endTime = strtotime($post['time'][1]);
  330. $where[]=["create_time","between","{$startTime},{$endTime}"];
  331. }
  332. $order = new ContractCommentModel();
  333. $data = $order
  334. // ->alias("o")
  335. // ->field("*,u1.mobile,u1.nickname,a.title as show_template_title,a.imgs as show_template_imgs")
  336. // ->leftJoin("user u1","u1.uid = uid")
  337. // ->leftJoin("show_template a","a.id = show_template_id")
  338. ->field('*')
  339. ->where($where)
  340. ->page((int)$post["page"], $pageSize)
  341. ->order("id","desc")
  342. ->select()
  343. ->toArray();
  344. // 处理图片数组
  345. foreach ($data as $k => $v) {
  346. $data[$k]['imgs'] = getImageAr($v['imgs']);
  347. }
  348. $pageCount = $order->where($where)->count();
  349. $result = UtilService::getParam([
  350. "id",
  351. "uid",
  352. "name",
  353. "contract_id",
  354. "contract_no",
  355. "to_uid",
  356. "to_name",
  357. "content",
  358. "create_time",
  359. // ['create_time', 'create_time', function ($item) {
  360. // return empty($item) ? "-" : date('Y-m-d H:i:s', $item);
  361. // }],
  362. ], $data);
  363. return app('json')->success([
  364. 'list' => $result,
  365. 'pageCount' => $pageCount,
  366. 'pageSize' => $pageSize,
  367. 'page' => $post['page'],
  368. ]);
  369. }
  370. // 删除评论
  371. public function deleteComment(\think\Request $request)
  372. {
  373. $id = $request->param('id');
  374. $article = ContractCommentModel::where('id', $id)->find();
  375. if (!$article) {
  376. return app('json')->fail('评论不存在');
  377. }
  378. $article->delete();
  379. return app('json')->success();
  380. }
  381. // 提前中断合同
  382. public function endComment(\think\Request $request)
  383. {
  384. $id = $request->param('id');
  385. $post = UtilService::getMore(
  386. [
  387. ['reason', ''],
  388. ], $request
  389. );
  390. $article = UserContractRecordModel::where('id', $id)->update(['status'=>2,'delete_time'=>time(),'reason'=>$post['reason']]);
  391. // if (!$article) {
  392. // return app('json')->fail('合同不存在');
  393. // }
  394. // $article->delete();
  395. return app('json')->success();
  396. }
  397. //
  398. // /**
  399. // * 合约列表
  400. // * @param \app\Request $request
  401. // * @return mixed
  402. // */
  403. // public function getContractList(\think\Request $request)
  404. // {
  405. //// $pageSize = 50;
  406. //// $post = UtilService::getMore([
  407. //// ['page',1],
  408. //// ['pageSize',50],
  409. //// ['nickname',''],
  410. ////// ['uid',''],
  411. //// ['parent_uid',''],
  412. //// ['mobile',''],
  413. //// ['status',''],
  414. //// ['time',[]],
  415. //// ],$request);
  416. ////// $post['uid']=$request->user["uid"];
  417. //// $data = (new UserModel)->getDataList($post,"*",1);
  418. //// return app('json')->success([
  419. //// 'list' => $data["list"],
  420. //// 'pageCount' => $data["totalCount"],
  421. //// 'pageSize' => $data["pageSize"],
  422. //// 'page' => $data["page"],
  423. //// ]);
  424. // $post = UtilService::getMore([
  425. // ['page', 1],
  426. // ['pageSize', 50],
  427. // ['status',-2] //1未签约 2已签约 3已解约
  428. // ], $request);
  429. // $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
  430. // $post["page"] = $post["page"]<=0 ? 1 : (int)$post["page"];
  431. // $where=[];
  432. // $uid = UtilService::getMore([
  433. // ['uid', 0],
  434. // ], $request);
  435. // $uid=$uid['uid'];
  436. // $where[]=["uid","=",$uid];
  437. // $totalCount = (new UserContractRecordModel)->where($where)->count();
  438. // if ($post["status"]!=-2){
  439. // $where[]=['status','=',$post["status"]];
  440. // }
  441. // $data=null;
  442. // if($totalCount>0){
  443. // $data = (new UserContractRecordModel)
  444. //// ->field("")
  445. //// ->alias("ut")
  446. //// ->join("show_template t", "t.id = show_template_id","left")
  447. // ->where($where)
  448. // ->order("is_default", "desc")
  449. // ->order("id", "desc")
  450. // ->page($post["page"], $post["pageSize"])
  451. // ->select();
  452. // foreach($data as $k=>$v){
  453. // $data[$k]["is_use"] = 1;//是否已经购买或者可以使用
  454. // switch ($data[$k]["status"]){
  455. // case 0:
  456. // $data[$k]["status_name"] = "未签约";
  457. // break;
  458. // case 1:
  459. // $data[$k]["status_name"] = "已签约";
  460. // break;
  461. // case -1:
  462. // $data[$k]["status_name"] = "已解约";
  463. // break;
  464. // }
  465. // }
  466. // }
  467. // $data = empty($data)?[]:$data;
  468. // return app('json')->success(["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount]);
  469. // }
  470. //
  471. // /**
  472. // * 甲方创建合约
  473. // */
  474. // public function form_save(Request $request){
  475. // $post = UtilService::getMore([
  476. // ['uid','0'], //甲方uid
  477. // ['phone',''], //甲方手机号
  478. // ['address',''], //甲方地址
  479. // ['card',''], //甲方身份证号
  480. // ['to_uid','0'], //员工uid
  481. // ['price',0], //服务费
  482. // ['deposit',0], // 定金
  483. // ['balance',0], //余款
  484. // ['period',0], // 周期天数
  485. // ['start_time',''], // 开始时间
  486. // ['end_time',''], // 结束时间
  487. //
  488. //// ['uid_img',''] //甲方签名图片路径
  489. //// ['to_phone',''].
  490. //// ['to_address',''],
  491. //// ['to_card',''],
  492. //// ['data',[]],
  493. //// ['year',''],
  494. //// ['month',''],
  495. //// ['day',''],
  496. //
  497. // ],$request);
  498. // $id = (int)$post["id"];
  499. //
  500. // $uid = (int)$post["uid"];
  501. // if(empty($uid)){
  502. // return app('json')->fail("参数错误");
  503. // }
  504. //// $year = $post['year'];
  505. //// $month = $post['month'];
  506. //// $day = $post['day'];
  507. ////
  508. ////// 检查年月日是否为空
  509. //// if (empty($year) || empty($month) || empty($day)) {
  510. //// return app('json')->fail("日期参数错误");
  511. //// }
  512. ////
  513. ////// 创建 DateTime 对象
  514. //// $date = \DateTime::createFromFormat('Y-m-d', "$year-$month-$day");
  515. ////
  516. ////// 检查日期是否有效
  517. //// if (!$date || $date->format('Y-m-d') !== "$year-$month-$day") {
  518. //// return app('json')->fail("无效的日期");
  519. //// }
  520. //// unset($post['year']);
  521. //// unset($post['month']);
  522. //// unset($post['day']);
  523. ////// 转换为时间戳
  524. //// $timestamp = $date->getTimestamp();
  525. ////
  526. //// $post['create_time'] = $timestamp;
  527. // //用户信息
  528. //// if(!empty($post["uid_img"])){
  529. //// $post['status'] = 2;
  530. //// }else{
  531. // $post['status'] = 0;
  532. //// }
  533. // if (empty($id)){
  534. // $post['contract_no'] = makeOrderId($post['uid'],"CR");
  535. // $r = (new UserContractRecordModel)->save($post);
  536. // }else{
  537. // $r = (new UserContractRecordModel)->where("id",$id)->update($post);
  538. // }
  539. //
  540. // return app('json')->success("数据保存成功");
  541. // }
  542. // /**
  543. // * 甲方签约合约
  544. // */
  545. // public function check(Request $request){
  546. // $post = UtilService::getMore([
  547. // ['id',0], //合约id
  548. // ['uid_img',''], //甲方签名图片路径
  549. // ['check_time','']//签约时间
  550. //// ['to_phone',''].
  551. //// ['to_address',''],
  552. //// ['to_card',''],
  553. //// ['data',[]],
  554. //// ['year',''],
  555. //// ['month',''],
  556. //// ['day',''],
  557. //
  558. // ],$request);
  559. // $info = (new UserContractRecordModel)->where("id",$post["id"])->find();
  560. // if(empty($info)){
  561. // return app('json')->fail("合约不存在");
  562. // }
  563. //
  564. // // 检查签约时间是否为空
  565. // if (empty($post['uid_img'])) {
  566. // return app('json')->fail("签字错误");
  567. // }
  568. //// 检查签约时间是否为空
  569. // if (empty($post['check_time'])) {
  570. // return app('json')->fail("日期参数错误");
  571. // }
  572. //
  573. //// $post['status'] = 1;
  574. // $post['from_check'] = 1;
  575. // if ($info['to_check']==1){
  576. // $post['status']==1;
  577. // }
  578. //
  579. //// $post['contract_no'] = makeOrderId($post['uid'],"CR");
  580. // $r = (new UserContractRecordModel)->where("id",$post["id"])->update($post);
  581. // return app('json')->success("数据保存成功");
  582. // }
  583. //// 乙方确认
  584. // public function to_check(Request $request){
  585. // $post = UtilService::getMore([
  586. // ['id','0'], //
  587. // ['to_uid_img',''], //乙方签名图片路径
  588. // ['to_phone',''], //乙方手机号
  589. // ['to_address',''], //乙方地址
  590. // ['to_card',''], //乙方身份证号
  591. // ['to_check_time','']//签约时间
  592. // ],$request);
  593. // $info = (new UserContractRecordModel)->where("id",$post["id"])->find();
  594. // if(empty($info)){
  595. // return app('json')->fail("合约不存在");
  596. // }
  597. // // 检查签约时间是否为空
  598. // if (empty($post['to_uid_img'])) {
  599. // return app('json')->fail("签字错误");
  600. // }
  601. //// 检查签约时间是否为空
  602. // if (empty($post['to_check_time'])) {
  603. // return app('json')->fail("日期参数错误");
  604. // }
  605. // $post['to_check'] = 1;
  606. // if ($info['from_check']==1){
  607. // $post['status']==1;
  608. // }
  609. // $r = (new UserContractRecordModel)->where("id",$post["id"])->update($post);
  610. // return app('json')->success("数据保存成功");
  611. // }
  612. //// 员工签到
  613. // public function clock_in(Request $request){
  614. // $post = UtilService::getMore([
  615. // ['id','0'], //合约id
  616. // ['longitude',''], //经度
  617. // ['latitude',''], //纬度
  618. //
  619. // ],$request);
  620. // $uid = (int)$post["uid"];
  621. // // 检查签约时间是否为空
  622. // if (empty($post['id'])) {
  623. // return app('json')->fail("签字错误");
  624. // }
  625. // $nickname=\app\model\api\User::where('uid',$uid)->value('nickname');
  626. // $r = (new UserContractRecordModel)->where("id",$post["id"])->save([
  627. // 'uid'=>$uid,
  628. // 'nickname' => $nickname,
  629. // 'longitude'=>$post['longitude'],
  630. // 'latitude'=>$post['latitude'],
  631. // 'contract_id'=>$post['id'],
  632. // 'create_time'=>time()
  633. // ]);
  634. // return app('json')->success("数据保存成功");
  635. // }
  636. //// 添加客户评论
  637. // public function comment(Request $request){
  638. // $post = UtilService::getMore([
  639. // ['id','0'], //合约id
  640. // ['content',''], //评论内容
  641. // ],$request);
  642. // $uid = (int)$post["uid"];
  643. // $info = (new UserContractRecordModel)->where("id",$post["id"])->find();
  644. // if(empty($info)){
  645. // return app('json')->fail("合约不存在");
  646. // }
  647. // if ($info['status']!=1){
  648. // return app('json')->fail("只能在签约期间才能发表评论");
  649. // }
  650. // // 检查签约时间是否为空
  651. // if (empty($post['id'])) {
  652. // return app('json')->fail("签字错误");
  653. // }
  654. // $r = (new ContractCommentModel)->save([
  655. // 'uid'=>$uid,
  656. // 'contract_id'=>$post['id'],
  657. // 'content'=>$post['content'],
  658. // 'create_time'=>time()
  659. // ]);
  660. // return app('json')->success("数据保存成功");
  661. // }
  662. }