10], [['tourist_id', 'to_org_id', 'run_date'], 'unique', 'targetAttribute' => ['tourist_id', 'to_org_id', 'run_date'], 'message' => 'The combination of Tourist ID, Run Date and To Org ID has already been taken.'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'tourist_id' => 'Tourist ID', 'create_user_id' => 'Create User ID', 'create_time' => 'Create Time', 'update_user_id' => 'Update User ID', 'update_time' => 'Update Time', 'cancel_flag' => 'Cancel Flag', 'is_onsale' => 'Is Onsale', 'run_date' => 'Run Date', 'to_org_id' => 'To Org ID', 'limit_total_num' => 'Limit Total Num', 'limit_adult_num' => 'Limit Adult Num', 'max_total_num' => 'Max Total Num', 'max_adult_num' => 'Max Adult Num', 'saled_adult_num' => 'Saled Adult Num', 'saled_child_num' => 'Saled Child Num', 'adult_price' => 'Adult Price', 'child_price' => 'Child Price', 'diff_price' => 'Diff Price', 'adult_cost' => 'Adult Cost', 'child_cost' => 'Child Cost', 'diff_cost' => 'Diff Cost', 'sale_type_adult' => 'Sale Type Adult', 'diff_para_adult' => 'Diff Para Adult', 'sale_type_child' => 'Sale Type Child', 'diff_para_child' => 'Diff Para Child', ]; } /** * Function Description:获取自由行产品价格日历加价方式统一接口 * Function Name: getTouristAddInfo * @param $tourist_id * @param $run_date * @param $org_id * * @return array * * @author 冒炎 */ public function getTouristAddInfo($tourist_id, $run_date, $org_id) { $result = array(); $list = (new Query()) ->select('tourist_id,sale_type_adult,diff_para_adult,sale_type_child,diff_para_child,is_onsale') ->from('opera_tourist_run') ->where(['tourist_id' => $tourist_id, 'run_date' => $run_date, 'to_org_id' => $org_id]) ->limit(1) ->one(); $list_default = (new Query()) ->select('tourist_id,sale_type_adult,diff_para_adult,sale_type_child,diff_para_child,is_onsale') ->from('opera_tourist_run') ->where(['tourist_id' => $tourist_id, 'run_date' => $run_date, 'to_org_id' => 0]) ->limit(1) ->one(); if(!$list){ $res = $list_default; }else{ $res = $list; } if (!$res) { //原渠道和通用渠道全部未设置,取默认设置 $sale_type_adult = 2; $sale_type_child = 2; $diff_para_adult = Yii::$app->params['tourist_profit'] ? Yii::$app->params['tourist_profit'] : 10; $diff_para_child = Yii::$app->params['tourist_profit'] ? Yii::$app->params['tourist_profit'] : 10; } else if (!$res['is_onsale']) { //该渠道日期下架不可售 $result['code'] = '1'; $result['info'] = '该日期不可售'; return $result; } else { $sale_type_adult = $res['sale_type_adult']; $sale_type_child = $res['sale_type_child']; $diff_para_adult = $res['diff_para_adult']; $diff_para_child = $res['diff_para_child']; } $result['code'] = '0'; $result['info'] = '获取加价信息成功'; $result['list'] = array('sale_type_adult' => $sale_type_adult, 'diff_para_adult' => $diff_para_adult,'sale_type_child'=>$sale_type_child,'diff_para_child'=>$diff_para_child); return $result; } }