status != 1) return 1082; } else { $taskModel = new self; } $taskModel->title = $params['title']; $taskModel->admin_id = $params['admin_id']; $taskModel->customer_id = $params['cust_id']; $taskModel->advertiser_id = $params['advertiser_id']; $taskModel->campaign_type = $params['campaign_type']; $taskModel->unit_charge_type = $params['unit_charge_type']; $taskModel->unit_price_type = $params['unit_price_type']; $taskModel->pay_method = $params['pay_method']; $taskModel->amount = $params['amount']; $taskModel->promotion_duration = $params['promotion_duration']; $taskModel->target_type = $params['target_type']; $taskModel->target_info = $params['target_info']; $taskModel->unit_price = $params['unit_price']; $taskModel->create_type = $params['create_type']; $taskModel->exec_time = $params['exec_time']; $taskModel->times = $params['times']; $taskModel->filter = json_encode(json_decode($params['filter'], true), 256); $result = $taskModel->save(); return $result ? 0 : 1083; } /** * 获取任务列表 * */ public static function getTaskList($customerId, $page, $pageSize) { $queryModel = self::where('customer_id', $customerId)->where('enable', 1); $count = $queryModel->count(); $list = $queryModel->selectRaw("id as config_id, title, admin_id, advertiser_id, create_type, exec_time, status, updated_at") ->offset(($page-1) * $pageSize)->limit($pageSize) ->orderBy('id', 'desc')->get(); return [$list, $count]; } }