WechatPlanRecord.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class WechatPlanRecord extends Model
  5. {
  6. // 自动写入时间戳字段
  7. protected $autoWriteTimestamp = 'int';
  8. // 定义时间戳字段名
  9. protected $createTime = 'createtime';
  10. protected $updateTime = 'updatetime';
  11. public function getIsOpenList()
  12. {
  13. return ['0' => __('Is_open 0'), '1' => __('Is_open 1')];
  14. }
  15. public static function getNewCode()
  16. {
  17. do {
  18. list($msec, $sec) = explode(' ', microtime());
  19. $msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
  20. $orderId = 'qy' . $msectime . mt_rand(10000, 99999);
  21. } while (self::where(['contract_code' => $orderId])->find());
  22. return $orderId;
  23. }
  24. // public static function plan_lst($where)
  25. // {
  26. // $model = new self;
  27. // $xwhere = null;
  28. // $order = "id desc";
  29. // if (isset($where['uid']) && $where['uid'] > 0) $xwhere['uid'] = $where['uid'];
  30. // if (isset($where['cid']) && $where['cid'] > 0) $xwhere['cid'] = $where['cid'];
  31. // $data = $model->where($xwhere)->where('is_signing',0)->order($order)->field('plan_id')->select();
  32. // var_dump($data);
  33. // $plan=new WechatPlan();
  34. // $data2=$plan->where('plan_id','in',['188873'])->select();
  35. // var_dump($data2);die();
  36. //// $count = $plan->where('id','in',$data)->count();
  37. // return $data2;
  38. // }
  39. public static function record_lst($where)
  40. {
  41. $model = new self;
  42. $xwhere = null;
  43. $order = "id desc";
  44. if (isset($where['uid']) && $where['uid'] > 0) $xwhere['uid'] = $where['uid'];
  45. if (isset($where['cid']) && $where['cid'] > 0) $xwhere['cid'] = $where['cid'];
  46. $data = $model->where($xwhere)->where('is_signing',0)->order($order)->select();
  47. $count = $model->where($xwhere)->count();
  48. return compact('count', 'data');
  49. }
  50. public static function record_info($where)
  51. {
  52. $model = new self;
  53. $xwhere = null;
  54. $order = "id desc";
  55. if (isset($where['id']) && $where['id'] > 0) $xwhere['id'] = $where['id'];
  56. // if (isset($where['cid']) && $where['cid'] > 0) $xwhere['cid'] = $where['cid'];
  57. // if (isset($where['category_id']) && $where['category_id'] > 0) $xwhere['category_id'] = $where['category_id'];
  58. $data = $model->where($xwhere)->where('is_signing',0)->order($order)->select();
  59. $count = $model->where($xwhere)->count();
  60. @file_put_contents("quanju.txt", json_encode($data)."-列表详情\r\n", 8);
  61. var_dump($data[0]['order_name']);die();
  62. // $lave = new Lave();
  63. // $list = $lave->where('uid', $where['uid'])->where('order_name', $data[0][''])->select();
  64. return compact('count', 'data');
  65. }
  66. }