| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class WechatPlanRecord extends Model
- {
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- public function getIsOpenList()
- {
- return ['0' => __('Is_open 0'), '1' => __('Is_open 1')];
- }
- public static function getNewCode()
- {
- do {
- list($msec, $sec) = explode(' ', microtime());
- $msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
- $orderId = 'qy' . $msectime . mt_rand(10000, 99999);
- } while (self::where(['contract_code' => $orderId])->find());
- return $orderId;
- }
- public static function plan_lst($where)
- {
- $model = new self;
- $xwhere = null;
- $order = "id desc";
- if (isset($where['uid']) && $where['uid'] > 0) $xwhere['uid'] = $where['uid'];
- if (isset($where['cid']) && $where['cid'] > 0) $xwhere['cid'] = $where['cid'];
- $data = $model->where($xwhere)->where('is_signing',0)->order($order)->field('plan_id')->select();
- var_dump($data);
- $plan=new WechatPlan();
- $data2=$plan->where('plan_id','in',['188873'])->select();
- var_dump($data2);die();
- // $count = $plan->where('id','in',$data)->count();
- return $data2;
- }
- public static function record_lst($where)
- {
- $model = new self;
- $xwhere = null;
- $order = "id desc";
- if (isset($where['uid']) && $where['uid'] > 0) $xwhere['uid'] = $where['uid'];
- if (isset($where['cid']) && $where['cid'] > 0) $xwhere['cid'] = $where['cid'];
- if (isset($where['category_id']) && $where['category_id'] > 0) $xwhere['category_id'] = $where['category_id'];
- $data = $model->where($xwhere)->where('is_signing',0)->order($order)->select();
- $count = $model->where($xwhere)->count();
- return compact('count', 'data');
- }
- }
|