Contract.php 23 KB

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