25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

634 satır
23 KiB

  1. <?php
  2. namespace common\models;
  3. use common\util\Util;
  4. use yii\db\Expression;
  5. use yii\db\ActiveRecord;
  6. /**
  7. * This is the model class for table "order_main".
  8. *
  9. * @property integer $order_id
  10. * @property string $order_name
  11. * @property string $spider_order_id
  12. * @property string $total_money
  13. * @property integer $category_id
  14. * @property integer $prod_cate_id
  15. * @property integer $prod_source
  16. * @property integer $prod_cnt
  17. * @property integer $sh_uid
  18. * @property integer $fx_uid
  19. * @property string $start_time
  20. * @property string $end_time
  21. * @property string $start_date
  22. * @property string $end_date
  23. * @property integer $order_status
  24. * @property string $update_time
  25. * @property string $create_time
  26. * @property integer $delete_flag
  27. * @property integer $system
  28. * @property string $start_area
  29. * @property string $end_area
  30. * @property integer $main_user_id
  31. */
  32. class OrderMain extends \yii\db\ActiveRecord
  33. {
  34. /**
  35. * @inheritdoc
  36. */
  37. public static function tableName()
  38. {
  39. return 'order_main';
  40. }
  41. /**
  42. * @inheritdoc
  43. */
  44. public function rules()
  45. {
  46. return [
  47. [['total_money','original_price'], 'number'],
  48. [['category_id', 'prod_cate_id', 'prod_source', 'prod_cnt', 'sh_uid', 'fx_uid', 'order_status', 'delete_flag', 'system', 'main_user_id'], 'integer'],
  49. [['start_time', 'end_time', 'start_date', 'end_date', 'update_time', 'create_time'], 'safe'],
  50. [['order_name', 'spider_order_id', 'start_area', 'end_area'], 'string', 'max' => 255],
  51. ];
  52. }
  53. /**
  54. * @inheritdoc
  55. */
  56. public function attributeLabels()
  57. {
  58. return [
  59. 'order_id' => 'Order ID',
  60. 'order_name' => 'Order Name',
  61. 'spider_order_id' => 'Spider Order ID',
  62. 'total_money' => 'Total Money',
  63. 'category_id' => 'Category ID',
  64. 'prod_cate_id' => 'Prod Cate ID',
  65. 'prod_source' => 'Prod Source',
  66. 'prod_cnt' => 'Prod Cnt',
  67. 'sh_uid' => 'Sh Uid',
  68. 'fx_uid' => 'Fx Uid',
  69. 'start_time' => 'Start Time',
  70. 'end_time' => 'End Time',
  71. 'start_date' => 'Start Date',
  72. 'end_date' => 'End Date',
  73. 'order_status' => 'Order Status',
  74. 'update_time' => 'Update Time',
  75. 'create_time' => 'Create Time',
  76. 'delete_flag' => 'Delete Flag',
  77. 'system' => 'System',
  78. 'start_area' => 'Start Area',
  79. 'end_area' => 'End Area',
  80. 'main_user_id' => 'Main User ID',
  81. 'original_price' => 'original_price'
  82. ];
  83. }
  84. /**
  85. * Function Description:插入主订单
  86. * Function Name: insertOrder
  87. * @param $param_arr
  88. *
  89. * @return bool
  90. *
  91. * @author 娄梦宁
  92. */
  93. public function insertOrder($param_arr)
  94. {
  95. $values = [
  96. 'total_money' => $param_arr['total_money'],
  97. 'prod_cate_id' => (int)$param_arr['pro_cate_id'],
  98. 'prod_cnt' => $param_arr['prod_cnt'],
  99. 'fx_uid' => $param_arr['fx_uid'],
  100. 'start_date' => $param_arr['start_date'],
  101. 'start_time' => $param_arr['start_time'],
  102. 'sh_uid' => $param_arr['sh_uid'],
  103. 'order_status' => 1,
  104. 'create_time' => date('Y-m-d H:i:s'),
  105. 'end_date' => date('Y-m-d', $param_arr['end_date']),
  106. 'category_id' => $param_arr['category_id']
  107. ];
  108. $this->attributes = $values;
  109. $res = $this->insert();
  110. if (!$res) {
  111. return false;
  112. } else {
  113. return true;
  114. }
  115. }
  116. /**
  117. * Function Description:查询订单是否支付
  118. * Function Name: getOrderStatus
  119. * @param $order_id
  120. *
  121. * @return array|null|\yii\db\ActiveRecord
  122. *
  123. * @author 娄梦宁
  124. */
  125. public function getOrderStatus($order_id)
  126. {
  127. $result = self::find()->select(['order_status'])
  128. ->from(self::tableName())
  129. ->where(['and', ['=', 'order_id', $order_id], ['=', 'delete_flag', 0]])
  130. ->asArray()
  131. ->one();
  132. return $result;
  133. }
  134. /**
  135. * Des:获取订单详情
  136. * Name: getOrderInfo
  137. * @param $order_id
  138. * @return array|null|\yii\db\ActiveRecord
  139. * @author 倪宗锋
  140. */
  141. public function getOrderInfo($order_id)
  142. {
  143. $result = self::find()
  144. ->from(self::tableName())
  145. ->where(['and', ['=', 'order_id', $order_id], ['=', 'delete_flag', 0]])
  146. ->asArray()
  147. ->one();
  148. return $result;
  149. }
  150. /**
  151. * Function Description:分销订单列表
  152. * Function Name: FxOrderList
  153. * @param $params array
  154. * @param $fx_uid
  155. * @return array|\yii\db\ActiveRecord[]
  156. *
  157. * @author 娄梦宁
  158. */
  159. public function FxOrderList($fx_uid, $params)
  160. {
  161. $where = ['and', ['=', 'a.fx_uid', $fx_uid], ['=', 'a.delete_flag', 0]];
  162. if (!empty($params['is_refund'])) {
  163. $where[] = ['in', 'b.status', explode(',', $params['is_refund'])];
  164. }
  165. if (!empty($params['status'])) {
  166. $where[] = ['in', 'a.order_status', explode(',', $params['status'])];
  167. }
  168. $offset = ($params['current_page'] - 1) * $params['page_size'];
  169. $select = [
  170. 'a.order_id',//订单ID
  171. 'a.order_status',//订单状态
  172. 'a.create_time',//创建时间
  173. 'a.total_money as order_total_money',//订单金额
  174. 'a.category_id',//订单类型ID
  175. 'a.order_name as pro_cate_name',//产品名称
  176. 'a.start_date',//出游时间
  177. 'prod_str' => new Expression("(SELECT GROUP_CONCAT(CONCAT(y.prod_name,',,',x.count) SEPARATOR '||') from order_info x LEFT JOIN prod_main y on x.prod_id = y.prod_id WHERE x.order_id = a.order_id and x.count != 0)"),
  178. 'b.status',//佣金状态
  179. 'commission_total_money' => new Expression("ifnull(b.total_money,0)"),//佣金金额
  180. "if(b.`status`=1,'待结算',if(b.`status`=2,'已结算','已取消')) as status_desc",//佣金结算状态
  181. 'c.room_name',//房型名称
  182. 'a.prod_cnt',//产品数量
  183. 'a.end_date',//结束日期
  184. 'c.total_details',//房型名称
  185. ];
  186. $result = self::find()->select($select)
  187. ->from(self::tableName() . ' as a')
  188. ->leftJoin('fx_commission_info b', 'a.order_id=b.order_id')
  189. ->leftJoin('order_hotel_extra c', 'c.main_order_id = a.order_id')
  190. ->where($where)
  191. ->orderBy('a.create_time DESC')
  192. ->limit($params['page_size'])
  193. ->offset($offset)
  194. ->asArray()
  195. ->all();
  196. return $result;
  197. }
  198. /**
  199. * Function Description:获取已完成订单
  200. * Function Name: getFinishOrder
  201. * @param $date
  202. *
  203. * @return array|null|\yii\db\ActiveRecord
  204. *
  205. * @author 娄梦宁
  206. */
  207. public function getFinishOrder($date)
  208. {
  209. $result = self::find()->select(['GROUP_CONCAT(order_id) as order_arr'])
  210. ->from(self::tableName())
  211. ->where(['and', ['=', 'order_status', 2], ['<', 'end_date', $date], ['=', 'delete_flag', 0]])
  212. ->asArray()
  213. ->one();
  214. return $result;
  215. }
  216. /**
  217. * Function Description:已完成订单状态变更
  218. * Function Name: uptFinishOrder
  219. * @param $order_arr
  220. *
  221. * @return int
  222. *
  223. * @author 娄梦宁
  224. */
  225. public function uptFinishOrder($order_arr)
  226. {
  227. $values = [
  228. 'order_status' => 3
  229. ];
  230. $count = self::updateAll($values, ['in', 'order_id', $order_arr]);
  231. return $count;
  232. }
  233. /**
  234. * Des:修改订单信息
  235. * Name: upOrder
  236. * @param $value
  237. * @param $orderIds
  238. * @return int
  239. * @author 倪宗锋
  240. */
  241. public function upOrder($value, $orderIds)
  242. {
  243. $count = self::updateAll($value, ['in', 'order_id', $orderIds]);
  244. return $count;
  245. }
  246. /**
  247. * Function Description:取消超时订单
  248. * Function Name: cancelOuttimeOrder
  249. *
  250. * @return bool
  251. *
  252. * @author 娄梦宁
  253. */
  254. public function cancelOuttimeOrder()
  255. {
  256. $values = [
  257. 'order_status' => 5
  258. ];
  259. $time = date('Y-m-d H:i:s', strtotime('-15 minute'));
  260. $count = self::updateAll($values, ['and', ['=', 'order_status', 1], ['<', 'create_time', $time]]);
  261. return $count;
  262. }
  263. /**
  264. * Des:管理后台 订单列表 获取订单列表信息
  265. * Name: getOrderListAdm
  266. * @param $param
  267. * @param int $type
  268. * @return array|mixed
  269. * @author 倪宗锋
  270. */
  271. public function getOrderListAdm($param, $type = 1)
  272. {
  273. //where条件
  274. $where = ['and', ['!=', 'a.order_status', 1], ['!=', 'a.order_status', 5], ['=', 'a.delete_flag', 0]];
  275. if ($param['order_id'] != '') {
  276. $where[] = ['like', 'a.order_id', $param['order_id']];
  277. }
  278. if ($param['category_id'] != '') {
  279. $where[] = ['=', 'a.category_id', $param['category_id']];
  280. }
  281. if ($param['create_time_start'] != '') {
  282. $where[] = ['>=', 'a.create_time', $param['create_time_start']];
  283. }
  284. if ($param['create_time_end'] != '') {
  285. $where[] = ['<', 'a.create_time', date('Y-m-d', strtotime("{$param['create_time_end']} +1 day"))];
  286. }
  287. if ($param['start_date_start'] != '') {
  288. $where[] = ['>=', 'a.start_date', $param['start_date_start']];
  289. }
  290. if ($param['start_date_end'] != '') {
  291. $where[] = ['<', 'a.start_date', date('Y-m-d', strtotime("{$param['start_date_end']} +1 day"))];
  292. }
  293. if ($param['order_status'] != '') {
  294. $where[] = ['=', 'a.order_status', $param['order_status']];
  295. }
  296. if ($param['fx_uid'] != '') {
  297. $where[] = ['=', 'a.fx_uid', $param['fx_uid']];
  298. }
  299. if ($param['pay_type'] != '') {
  300. $where[] = ['=', 'd.pay_type', $param['pay_type']];
  301. }
  302. if (empty($param['user_area']) == false) {
  303. $where[] = ['=', 'g.user_area', $param['user_area']];
  304. }
  305. //果运营主体非1或空,则读取自身对应的订单数据,如果运营主体为空,或者运营主体是1则读取订单运营主体是0或1的订单
  306. $cookies = $_COOKIE;
  307. if (empty($cookies['user_main_corp']) == false && $cookies['user_main_corp'] != 1 && in_array(YII_ENV,['pro','dev'])) {
  308. $where[] = ['=', 'e.main_corp_id', $cookies['user_main_corp']];
  309. }
  310. //运营负责人
  311. if (empty($param['main_search']) == false) {
  312. $where[] = ['=', 'a.main_user_id', $param['main_search']];
  313. }
  314. //联系人 和手机号
  315. if (empty($param['contacts_name']) == false) {
  316. $where[] = ['like', 'f.contacts_name', $param['contacts_name']];
  317. }
  318. if (empty($param['contacts_phone']) == false) {
  319. $where[] = ['like', 'f.contacts_phone', $param['contacts_phone']];
  320. }
  321. if ($type == 1) {//获取count
  322. $select = ["count(1) cnt"];
  323. $result = self::find()->select($select)
  324. ->from(self::tableName() . ' a')
  325. ->innerJoin('base_category c', ' a.category_id = c.category_id')
  326. ->innerJoin('pay_main d', ' a.order_id = d.order_id')
  327. ->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id=e.id')
  328. ->leftJoin(OrderContacts::tableName() . ' f', 'a.order_id=f.order_id and f.contacts_type=1')
  329. ->leftJoin(FxUser::tableName() . ' g', 'a.fx_uid=g.uid')
  330. ->where($where)
  331. ->asArray()
  332. ->one();
  333. return $result['cnt'];
  334. } else if ($type == 3) {
  335. $select = ["count(1) cnt", "sum(total_money) total_money"];
  336. $where[] = ['in', 'a.order_status', [2, 3]];
  337. $result = self::find()->select($select)
  338. ->from(self::tableName() . ' a')
  339. ->innerJoin('base_category c', ' a.category_id = c.category_id')
  340. ->innerJoin('pay_main d', ' a.order_id = d.order_id')
  341. ->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id=e.id')
  342. ->leftJoin(OrderContacts::tableName() . ' f', 'a.order_id=f.order_id and f.contacts_type=1')
  343. ->leftJoin(FxUser::tableName() . ' g', 'a.fx_uid=g.uid')
  344. ->where($where)
  345. ->asArray()
  346. ->one();
  347. return $result;
  348. } else {//获取列表
  349. //查询字段
  350. $select = [
  351. 'a.order_id',//订单ID
  352. "a.create_time as create_order_time",//下单时间
  353. "c.category_name as order_type_des",//订单类型
  354. "a.order_name as book_product",//产品品类名称
  355. "(
  356. SELECT GROUP_CONCAT(CONCAT(x.prod_name,'X',x.count) SEPARATOR ' ')
  357. from order_info x
  358. WHERE x.order_id = a.order_id
  359. GROUP BY x.order_id
  360. ) as prod_des
  361. ",//具体产品及数量
  362. "CONCAT(a.start_date,' ',IFNULL(a.start_time,'')) as start_time",//出发时间
  363. "(SELECT contacts_name from order_contacts where a.order_id = order_id and contacts_type=1 ) as contacts_name",
  364. "(SELECT contacts_phone from order_contacts where a.order_id = order_id and contacts_type=1) as contacts_phone",
  365. "(SELECT contacts_ID from order_contacts where a.order_id = order_id and contacts_type=1) as contacts_ID",
  366. new Expression("CASE a.order_status
  367. WHEN 1 THEN '待支付'
  368. WHEN 2 THEN '已支付'
  369. WHEN 3 THEN '已完成'
  370. WHEN 4 THEN '已退款'
  371. WHEN 5 THEN '已取消'
  372. ELSE ''
  373. END
  374. as order_status_des
  375. ")
  376. ,//订单状态名称
  377. "a.order_status as order_status_id",//订单状态标识ID
  378. "if(d.pay_type=1,'微信',if(d.pay_type=2,'支付宝','预付款')) as pay_type_des",//支付类型名称
  379. 'order_come' => new Expression("(SELECT CONCAT(nickname,'<br/>',phone) from fx_user where a.fx_uid = uid)"),//订单来源(分销商)
  380. "if(a.order_status in (1,2),
  381. if(a.start_date >= '" . date('Y-m-d') . "',0,1), 1)
  382. as if_can_cancel",//是否可以取消订单
  383. 'a.total_money',
  384. 'a.start_area',
  385. 'a.end_area',
  386. 'a.prod_cnt',
  387. 'a.category_id',
  388. 'a.end_time',
  389. 'system' => new Expression("if(a.system=1,'分销',if(a.system=2,'微信','官网'))"),
  390. 'user_area_name' => new Expression("(select area_name from fx_user_area where area_id = g.user_area)"),
  391. 'a.remark',
  392. "commission_amount" => new Expression("(SELECT SUM(total_money) from fx_commission_info WHERE order_id = a.order_id)")
  393. ];
  394. $offset = ($param['current_page'] - 1) * $param['page_size'];
  395. $result = self::find()->select($select)
  396. ->from(self::tableName() . ' a')
  397. ->innerJoin('base_category c', ' a.category_id = c.category_id')
  398. ->innerJoin('pay_main d', ' a.order_id = d.order_id')
  399. ->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id=e.id')
  400. ->leftJoin(OrderContacts::tableName() . ' f', 'a.order_id=f.order_id and f.contacts_type=1')
  401. ->leftJoin(FxUser::tableName() . ' g', 'a.fx_uid=g.uid')
  402. ->where($where)
  403. ->orderBy('a.create_time DESC')
  404. ->offset($offset)
  405. ->limit($param['page_size'])
  406. ->asArray()
  407. ->all();
  408. return $result;
  409. }
  410. }
  411. /*
  412. * 订单列表
  413. */
  414. public function AdminCommissionList($param)
  415. {
  416. //where条件
  417. $where = ['and', ['!=', 'a.order_status', 1], ['!=', 'a.order_status', 5], ['=', 'a.delete_flag', 0], ['=', 'a.fx_uid', $param['fx_uid']]];
  418. if ($param['order_id'] != '') {
  419. $where[] = ['like', 'a.order_id', $param['order_id']];
  420. }
  421. if ($param['order_type_id'] != '') {
  422. $where[] = ['=', 'a.category_id', $param['order_type_id']];
  423. }
  424. if ($param['create_order_start_date'] != '') {
  425. $where[] = ['>=', 'a.create_time', $param['create_order_start_date']];
  426. }
  427. if ($param['create_order_end_date'] != '') {
  428. $where[] = ['<', 'a.create_time', date('y-m-d', strtotime("{$param['create_order_end_date']} +1 day"))];
  429. }
  430. if ($param['order_status_id'] != '') {
  431. $where[] = ['=', 'a.order_status', $param['order_status_id']];
  432. }
  433. if ($param['settlement_start_date'] != '') {
  434. $where[] = ['>=', 'a.end_date', date('Y-m-d', strtotime("{$param['settlement_start_date']} -3 day"))];
  435. }
  436. if ($param['settlement_end_date'] != '') {
  437. $where[] = ['<', 'a.end_date', date('Y-m-d', strtotime("{$param['settlement_end_date']} -2 day"))];
  438. }
  439. $select = [
  440. 'a.order_id',
  441. 'a.category_id as order_type_id',
  442. new Expression("CASE a.category_id
  443. WHEN 1 THEN '车票'
  444. WHEN 2 THEN '门票'
  445. WHEN 3 THEN '酒店'
  446. ELSE ''
  447. END
  448. as order_type_des
  449. ")
  450. ,
  451. 'a.create_time as create_order_date',
  452. 'a.total_money as order_price',
  453. 'a.order_status as order_status_id',
  454. new Expression("CASE a.order_status
  455. WHEN 2 THEN '已支付'
  456. WHEN 3 THEN '已完成'
  457. WHEN 4 THEN '已退款'
  458. ELSE ''
  459. END
  460. as order_status_des
  461. ")
  462. ,
  463. 'date_add(a.end_date,INTERVAL 3 DAY) as settlement_order_date',
  464. 'b.total_money as all_commission_money'
  465. ];
  466. $offset = ($param['current_page'] - 1) * $param['page_size'];
  467. $result = self::find()->select($select)
  468. ->from(self::tableName() . ' as a')
  469. ->leftJoin('fx_commission_info as b', 'a.order_id=b.order_id')
  470. ->where($where)
  471. ->orderBy('a.create_time DESC')
  472. ->offset($offset)
  473. ->limit($param['page_size'])
  474. ->asArray()
  475. ->all();
  476. $count = self::find()->select('count(1) as count')->from(self::tableName() . ' as a')->where($where)->asArray()->one();
  477. $count = $count['count'];
  478. return ['list' => $result, 'count' => $count];
  479. }
  480. /**
  481. * Des:获取订单退款信息
  482. * Name: getOrderRefund
  483. * @param $order_id
  484. * @return array
  485. * @author 倪宗锋
  486. */
  487. public function getOrderRefund($order_id)
  488. {
  489. $select = [
  490. 'IFNULL(a.spider_order_id,a.order_id) as order_id',
  491. 'b.pro_cate_name',
  492. 'a.spider_order_id',
  493. 'a.start_date',
  494. 'a.start_time',
  495. 'a.category_id'
  496. ];
  497. $result = self::find()
  498. ->select($select)
  499. ->from(OrderMain::tableName() . ' a')
  500. ->innerJoin(ProdCategory::tableName() . ' b', 'a.prod_cate_id = b.pro_cate_id')
  501. ->where(['=', 'a.order_id', $order_id])
  502. ->asArray()
  503. ->one();
  504. return $result;
  505. }
  506. /**
  507. * Des:判断某个产品是否存在订单
  508. * Name: existOrder
  509. * @param $param
  510. * @return bool
  511. * @author 付泓程
  512. */
  513. public function existOrder($param)
  514. {
  515. $prod_cate_id = $param['prod_cate_id'];
  516. $start_date = $param['start_date'];
  517. $run_time = $param['start_time'];
  518. $small24 = $param['small24']; //是否小于0 -即提前X天。
  519. $select = ['count(order_id) as count'];
  520. // $sql = "select count(order_id) as count from order_main where prod_cate_id = {$prod_cate_id} and start_date={$start_date} and order_status = 3 and delete_flag=0";
  521. $where = ['and', ['=', 'a.prod_cate_id', $prod_cate_id], ['=', 'a.start_date', $start_date], ['=', 'a.order_status', 2], ['=', 'a.delete_flag', 0]];
  522. if (!$small24) {
  523. $where[] = ['>=', 'a.start_time', $run_time];
  524. }
  525. $result = self::find()
  526. ->select($select)
  527. ->from(OrderMain::tableName() . ' a')
  528. ->where($where)
  529. ->asArray()
  530. ->one();
  531. $count = $result['count'];
  532. if ($count > 0) {
  533. return true;
  534. }
  535. return false;
  536. }
  537. /**
  538. * des 获取订单支付详细信息
  539. * @param $orderId
  540. * @return array
  541. */
  542. public function getOrderPayInfo($orderId)
  543. {
  544. $select = [
  545. 'a.order_id',
  546. 'b.pro_cate_name',
  547. new Expression("concat(a.start_date,' ',a.start_time) as 'run_time'"),
  548. 'a.category_id',
  549. new Expression("(select category_name from base_category WHERE category_id = a.category_id) as category_name"),
  550. 'a.prod_cnt',
  551. 'a.create_time',
  552. 'a.order_status',
  553. 'a.total_money',
  554. 'c.contacts_name',
  555. 'c.contacts_phone'
  556. ];
  557. $result = self::find()
  558. ->select($select)
  559. ->from(OrderMain::tableName() . ' a')
  560. ->innerJoin(ProdCategory::tableName() . ' b', 'a.prod_cate_id = b.pro_cate_id')
  561. ->innerJoin(OrderContacts::tableName() . ' c', 'a.order_id = c.order_id and c.contacts_type=1 ')
  562. ->where(['=', 'a.order_id', $orderId])
  563. ->asArray()
  564. ->one();
  565. return $result;
  566. }
  567. /**
  568. * Des:订单初始化运营负责人
  569. * Name: bindMainCorp
  570. * @param $fx_uid
  571. * @param $main_user_id
  572. * @return int
  573. * @author 倪宗锋
  574. */
  575. public function bindMainCorp($fx_uid, $main_user_id)
  576. {
  577. $count = self::updateAll(['main_user_id' => $main_user_id], ['=', 'fx_uid', $fx_uid]);
  578. return $count;
  579. }
  580. /**
  581. * Des:获取酒店订单数据
  582. * Name: getHotelOrderInfo
  583. * @param $order_id
  584. * @return array
  585. * @author 倪宗锋
  586. */
  587. public function getHotelOrderInfo($order_id)
  588. {
  589. $select = [
  590. 'a.order_id',
  591. 'c.hotel_id',
  592. 'c.room_id',
  593. 'a.prod_cnt',
  594. 'a.start_date',
  595. 'a.end_date',
  596. 'a.total_money',
  597. 'b.contacts_name',
  598. 'b.contacts_phone',
  599. 'c.total_details',
  600. 'a.system'
  601. ];
  602. $where = ['=','a.order_id', $order_id];
  603. $getInfo = self::find()->select($select)
  604. ->from(self::tableName().' a')
  605. ->innerJoin(OrderContacts::tableName().' b','a.order_id = b.order_id and b.contacts_type=1')
  606. ->innerJoin('order_hotel_extra c','a.order_id = c.main_order_id')
  607. ->where($where)
  608. ->asArray()
  609. ->one();
  610. return $getInfo;
  611. }
  612. }