Contract.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  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. "create_time"
  278. // ['create_time', 'create_time', function ($item) {
  279. // return empty($item) ? "-" : date('Y-m-d H:i:s', $item);
  280. // }],
  281. ], $data);
  282. return app('json')->success([
  283. 'list' => $result,
  284. 'pageCount' => $pageCount,
  285. 'pageSize' => $pageSize,
  286. 'page' => $post['page'],
  287. ]);
  288. }
  289. /**
  290. * 评价列表
  291. * @param Request $request
  292. */
  293. public function contractCommentList(Request $request)
  294. {
  295. $pageSize = 50;
  296. $post = UtilService::getMore(
  297. [
  298. ['page', 1],
  299. ['uid',0], //甲方
  300. ['to_uid',''], //乙方
  301. ['contract_id', ''], //签约id
  302. ['contract_no', ''], //签约编号
  303. ['time',[]],
  304. ], $request
  305. );
  306. $where = [];
  307. if(!empty($post['uid'])){
  308. $where[]=["uid","=",$post['uid']];
  309. }
  310. // else
  311. // if(!empty($post['mobile'])){
  312. // $m = Db::name("user")->where("mobile",$post['mobile'])->find();
  313. // if(!empty($m)) {
  314. // $where[]=["o.uid","=",$m['uid']];
  315. // }
  316. // }
  317. if(!empty($post['nickname'])){
  318. $where[]=["nickname","like","%{$post["name"]}%"];
  319. }
  320. if(!empty($post['contract_id'])){
  321. $where[]=["contract_id","=",$post['contract_id']];
  322. }
  323. //创建时间
  324. $startTime="";
  325. $endTime="";
  326. if(!empty($post['time'][0]) && !empty($post['time'][1])) {
  327. $startTime = strtotime($post['time'][0]);
  328. $endTime = strtotime($post['time'][1]);
  329. $where[]=["create_time","between","{$startTime},{$endTime}"];
  330. }
  331. $order = new ContractCommentModel();
  332. $data = $order
  333. // ->alias("o")
  334. // ->field("*,u1.mobile,u1.nickname,a.title as show_template_title,a.imgs as show_template_imgs")
  335. // ->leftJoin("user u1","u1.uid = uid")
  336. // ->leftJoin("show_template a","a.id = show_template_id")
  337. ->field('*')
  338. ->where($where)
  339. ->page((int)$post["page"], $pageSize)
  340. ->order("id","desc")
  341. ->select()
  342. ->toArray();
  343. $pageCount = $order->where($where)->count();
  344. $result = UtilService::getParam([
  345. "id",
  346. "uid",
  347. "name",
  348. "contract_id",
  349. "contract_no",
  350. "to_uid",
  351. "to_name",
  352. "content",
  353. "create_time",
  354. // ['create_time', 'create_time', function ($item) {
  355. // return empty($item) ? "-" : date('Y-m-d H:i:s', $item);
  356. // }],
  357. ], $data);
  358. return app('json')->success([
  359. 'list' => $result,
  360. 'pageCount' => $pageCount,
  361. 'pageSize' => $pageSize,
  362. 'page' => $post['page'],
  363. ]);
  364. }
  365. // 删除评论
  366. public function deleteComment(\think\Request $request)
  367. {
  368. $id = $request->param('id');
  369. $article = ContractCommentModel::where('id', $id)->find();
  370. if (!$article) {
  371. return app('json')->fail('评论不存在');
  372. }
  373. $article->delete();
  374. return app('json')->success();
  375. }
  376. //
  377. // /**
  378. // * 合约列表
  379. // * @param \app\Request $request
  380. // * @return mixed
  381. // */
  382. // public function getContractList(\think\Request $request)
  383. // {
  384. //// $pageSize = 50;
  385. //// $post = UtilService::getMore([
  386. //// ['page',1],
  387. //// ['pageSize',50],
  388. //// ['nickname',''],
  389. ////// ['uid',''],
  390. //// ['parent_uid',''],
  391. //// ['mobile',''],
  392. //// ['status',''],
  393. //// ['time',[]],
  394. //// ],$request);
  395. ////// $post['uid']=$request->user["uid"];
  396. //// $data = (new UserModel)->getDataList($post,"*",1);
  397. //// return app('json')->success([
  398. //// 'list' => $data["list"],
  399. //// 'pageCount' => $data["totalCount"],
  400. //// 'pageSize' => $data["pageSize"],
  401. //// 'page' => $data["page"],
  402. //// ]);
  403. // $post = UtilService::getMore([
  404. // ['page', 1],
  405. // ['pageSize', 50],
  406. // ['status',-2] //1未签约 2已签约 3已解约
  407. // ], $request);
  408. // $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
  409. // $post["page"] = $post["page"]<=0 ? 1 : (int)$post["page"];
  410. // $where=[];
  411. // $uid = UtilService::getMore([
  412. // ['uid', 0],
  413. // ], $request);
  414. // $uid=$uid['uid'];
  415. // $where[]=["uid","=",$uid];
  416. // $totalCount = (new UserContractRecordModel)->where($where)->count();
  417. // if ($post["status"]!=-2){
  418. // $where[]=['status','=',$post["status"]];
  419. // }
  420. // $data=null;
  421. // if($totalCount>0){
  422. // $data = (new UserContractRecordModel)
  423. //// ->field("")
  424. //// ->alias("ut")
  425. //// ->join("show_template t", "t.id = show_template_id","left")
  426. // ->where($where)
  427. // ->order("is_default", "desc")
  428. // ->order("id", "desc")
  429. // ->page($post["page"], $post["pageSize"])
  430. // ->select();
  431. // foreach($data as $k=>$v){
  432. // $data[$k]["is_use"] = 1;//是否已经购买或者可以使用
  433. // switch ($data[$k]["status"]){
  434. // case 0:
  435. // $data[$k]["status_name"] = "未签约";
  436. // break;
  437. // case 1:
  438. // $data[$k]["status_name"] = "已签约";
  439. // break;
  440. // case -1:
  441. // $data[$k]["status_name"] = "已解约";
  442. // break;
  443. // }
  444. // }
  445. // }
  446. // $data = empty($data)?[]:$data;
  447. // return app('json')->success(["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount]);
  448. // }
  449. //
  450. // /**
  451. // * 甲方创建合约
  452. // */
  453. // public function form_save(Request $request){
  454. // $post = UtilService::getMore([
  455. // ['uid','0'], //甲方uid
  456. // ['phone',''], //甲方手机号
  457. // ['address',''], //甲方地址
  458. // ['card',''], //甲方身份证号
  459. // ['to_uid','0'], //员工uid
  460. // ['price',0], //服务费
  461. // ['deposit',0], // 定金
  462. // ['balance',0], //余款
  463. // ['period',0], // 周期天数
  464. // ['start_time',''], // 开始时间
  465. // ['end_time',''], // 结束时间
  466. //
  467. //// ['uid_img',''] //甲方签名图片路径
  468. //// ['to_phone',''].
  469. //// ['to_address',''],
  470. //// ['to_card',''],
  471. //// ['data',[]],
  472. //// ['year',''],
  473. //// ['month',''],
  474. //// ['day',''],
  475. //
  476. // ],$request);
  477. // $id = (int)$post["id"];
  478. //
  479. // $uid = (int)$post["uid"];
  480. // if(empty($uid)){
  481. // return app('json')->fail("参数错误");
  482. // }
  483. //// $year = $post['year'];
  484. //// $month = $post['month'];
  485. //// $day = $post['day'];
  486. ////
  487. ////// 检查年月日是否为空
  488. //// if (empty($year) || empty($month) || empty($day)) {
  489. //// return app('json')->fail("日期参数错误");
  490. //// }
  491. ////
  492. ////// 创建 DateTime 对象
  493. //// $date = \DateTime::createFromFormat('Y-m-d', "$year-$month-$day");
  494. ////
  495. ////// 检查日期是否有效
  496. //// if (!$date || $date->format('Y-m-d') !== "$year-$month-$day") {
  497. //// return app('json')->fail("无效的日期");
  498. //// }
  499. //// unset($post['year']);
  500. //// unset($post['month']);
  501. //// unset($post['day']);
  502. ////// 转换为时间戳
  503. //// $timestamp = $date->getTimestamp();
  504. ////
  505. //// $post['create_time'] = $timestamp;
  506. // //用户信息
  507. //// if(!empty($post["uid_img"])){
  508. //// $post['status'] = 2;
  509. //// }else{
  510. // $post['status'] = 0;
  511. //// }
  512. // if (empty($id)){
  513. // $post['contract_no'] = makeOrderId($post['uid'],"CR");
  514. // $r = (new UserContractRecordModel)->save($post);
  515. // }else{
  516. // $r = (new UserContractRecordModel)->where("id",$id)->update($post);
  517. // }
  518. //
  519. // return app('json')->success("数据保存成功");
  520. // }
  521. // /**
  522. // * 甲方签约合约
  523. // */
  524. // public function check(Request $request){
  525. // $post = UtilService::getMore([
  526. // ['id',0], //合约id
  527. // ['uid_img',''], //甲方签名图片路径
  528. // ['check_time','']//签约时间
  529. //// ['to_phone',''].
  530. //// ['to_address',''],
  531. //// ['to_card',''],
  532. //// ['data',[]],
  533. //// ['year',''],
  534. //// ['month',''],
  535. //// ['day',''],
  536. //
  537. // ],$request);
  538. // $info = (new UserContractRecordModel)->where("id",$post["id"])->find();
  539. // if(empty($info)){
  540. // return app('json')->fail("合约不存在");
  541. // }
  542. //
  543. // // 检查签约时间是否为空
  544. // if (empty($post['uid_img'])) {
  545. // return app('json')->fail("签字错误");
  546. // }
  547. //// 检查签约时间是否为空
  548. // if (empty($post['check_time'])) {
  549. // return app('json')->fail("日期参数错误");
  550. // }
  551. //
  552. //// $post['status'] = 1;
  553. // $post['from_check'] = 1;
  554. // if ($info['to_check']==1){
  555. // $post['status']==1;
  556. // }
  557. //
  558. //// $post['contract_no'] = makeOrderId($post['uid'],"CR");
  559. // $r = (new UserContractRecordModel)->where("id",$post["id"])->update($post);
  560. // return app('json')->success("数据保存成功");
  561. // }
  562. //// 乙方确认
  563. // public function to_check(Request $request){
  564. // $post = UtilService::getMore([
  565. // ['id','0'], //
  566. // ['to_uid_img',''], //乙方签名图片路径
  567. // ['to_phone',''], //乙方手机号
  568. // ['to_address',''], //乙方地址
  569. // ['to_card',''], //乙方身份证号
  570. // ['to_check_time','']//签约时间
  571. // ],$request);
  572. // $info = (new UserContractRecordModel)->where("id",$post["id"])->find();
  573. // if(empty($info)){
  574. // return app('json')->fail("合约不存在");
  575. // }
  576. // // 检查签约时间是否为空
  577. // if (empty($post['to_uid_img'])) {
  578. // return app('json')->fail("签字错误");
  579. // }
  580. //// 检查签约时间是否为空
  581. // if (empty($post['to_check_time'])) {
  582. // return app('json')->fail("日期参数错误");
  583. // }
  584. // $post['to_check'] = 1;
  585. // if ($info['from_check']==1){
  586. // $post['status']==1;
  587. // }
  588. // $r = (new UserContractRecordModel)->where("id",$post["id"])->update($post);
  589. // return app('json')->success("数据保存成功");
  590. // }
  591. //// 员工签到
  592. // public function clock_in(Request $request){
  593. // $post = UtilService::getMore([
  594. // ['id','0'], //合约id
  595. // ['longitude',''], //经度
  596. // ['latitude',''], //纬度
  597. //
  598. // ],$request);
  599. // $uid = (int)$post["uid"];
  600. // // 检查签约时间是否为空
  601. // if (empty($post['id'])) {
  602. // return app('json')->fail("签字错误");
  603. // }
  604. // $nickname=\app\model\api\User::where('uid',$uid)->value('nickname');
  605. // $r = (new UserContractRecordModel)->where("id",$post["id"])->save([
  606. // 'uid'=>$uid,
  607. // 'nickname' => $nickname,
  608. // 'longitude'=>$post['longitude'],
  609. // 'latitude'=>$post['latitude'],
  610. // 'contract_id'=>$post['id'],
  611. // 'create_time'=>time()
  612. // ]);
  613. // return app('json')->success("数据保存成功");
  614. // }
  615. //// 添加客户评论
  616. // public function comment(Request $request){
  617. // $post = UtilService::getMore([
  618. // ['id','0'], //合约id
  619. // ['content',''], //评论内容
  620. // ],$request);
  621. // $uid = (int)$post["uid"];
  622. // $info = (new UserContractRecordModel)->where("id",$post["id"])->find();
  623. // if(empty($info)){
  624. // return app('json')->fail("合约不存在");
  625. // }
  626. // if ($info['status']!=1){
  627. // return app('json')->fail("只能在签约期间才能发表评论");
  628. // }
  629. // // 检查签约时间是否为空
  630. // if (empty($post['id'])) {
  631. // return app('json')->fail("签字错误");
  632. // }
  633. // $r = (new ContractCommentModel)->save([
  634. // 'uid'=>$uid,
  635. // 'contract_id'=>$post['id'],
  636. // 'content'=>$post['content'],
  637. // 'create_time'=>time()
  638. // ]);
  639. // return app('json')->success("数据保存成功");
  640. // }
  641. }