$param['merchant_id'], 'store_id' => $param['store_id'], 'status' => 1, 'state' => 1, 'recharge_money' => ['elt', $param['recharge_money']], 'surplus' => ['eq', '-1', ['gt', 0], 'or'], 'start_time' => [['eq', ''], ['lt', $time], 'or'], 'end_time' => [['eq', ''], ['gt', $time], 'or'], 'role_type' => $param['user_type'] ? $param['user_type'] : 3, 'scene_type' => 1 ]; switch ($param['activity_type']) { case 1: //线上 $where['online_state'] = 1; break; case 2: //线下 $where['line_state'] = 1; break; } $fields = [ 'id', 'recharge_money', 'give_money', 'surplus', 'limit_num', 'aging_repay', 'aging_time' ]; try { $VipRechargeModel = new RetailVipRechargeModel(); $activity = $VipRechargeModel->getOrderFind($where, $fields, 'give_money desc'); $activity = $activity ? $activity : []; return callBack(statusCode()['success'], "活动最大的赠送金额查询成功", $activity); } catch (\Exception $e) { return callBack(statusCode()['error'], "活动最大的赠送金额查询失败"); } } /** * 依据活动id查询可使用的活动信息 * @param $param * [ * merchant_id * store_id * id 活动id * activity_type 1线上活动 2线下活动 * ] * @return mixed * [ * data 活动信息 * ] */ public function basisIdGetInfo($param) { // 充值活动查询条件 $time = time(); $where = [ 'id' => $param['id'], 'merchant_id' => $param['merchant_id'], 'store_id' => $param['store_id'], 'status' => 1, 'state' => 1, 'surplus' => [['gt', 0], ['eq', '-1'], 'or'], 'start_time' => [['eq', ''], ['lt', $time], 'or'], 'end_time' => [['eq', ''], ['gt', $time], 'or'] ]; switch ($param['activity_type']) { case 1: //线上活动 $where['online_state'] = 1; break; case 2: //线下活动 $where['line_state'] = 1; break; } $fields = [ 'id', 'recharge_money', 'give_money', 'surplus', 'limit_num', 'aging_repay', 'aging_time' ]; try { $VipRechargeModel = new RetailVipRechargeModel(); $info = $VipRechargeModel->getFind($where, $fields); if (!empty($info)) { return callBack(statusCode()['success'], "充值活动查询成功", $info); } else { return callBack(statusCode()['error'], "充值活动查询失败"); } } catch (\Exception $e) { return callBack(statusCode()['error'], "充值活动查询失败"); } } }