소스 검색

Merge branch 'dev'

master
부모
커밋
16138b6cad
2개의 변경된 파일17개의 추가작업 그리고 5개의 파일을 삭제
  1. +7
    -1
      common/models/User.php
  2. +10
    -4
      producer/controllers/OrderController.php

+ 7
- 1
common/models/User.php 파일 보기

@@ -590,7 +590,13 @@ class User extends ActiveRecordCommon implements IdentityInterface
*/
public function getFavoritePointSale()
{
$arrayUserPointSale = UserPointSale::find()->where(['id_user' => $this->id])->all() ;
$arrayUserPointSale = UserPointSale::find()
->innerJoinWith('pointSale')
->where([
'user_point_sale.id_user' => $this->id,
'point_sale.id_producer' => Producer::getId()
])
->all() ;
if(count($arrayUserPointSale) == 1) {
$pointSale = PointSale::findOne(['id' => $arrayUserPointSale[0]->id_point_sale]) ;

+ 10
- 4
producer/controllers/OrderController.php 파일 보기

@@ -571,12 +571,18 @@ class OrderController extends ProducerBaseController
$favoritePointSale = User::getCurrent()->getFavoritePointSale() ;
if($favoritePointSale) {
foreach($pointsSaleArray as $key => $pointSale) {
if($pointSale['id'] == $favoritePointSale->id) {
unset($pointsSaleArray[$key]) ;
array_unshift($pointsSaleArray, $pointSale) ;
for( $i = 0; $i < count($pointsSaleArray) ; $i++) {
if($pointsSaleArray[$i]['id'] == $favoritePointSale->id) {
$theFavoritePointSale = $pointsSaleArray[$i] ;
unset($pointsSaleArray[$i]) ;
}
}

if(isset($theFavoritePointSale)) {
$pointsSaleArray = array_reverse($pointsSaleArray, false) ;
$pointsSaleArray[] = $theFavoritePointSale ;
$pointsSaleArray = array_reverse($pointsSaleArray, false) ;
}
}
$json['points_sale'] = $pointsSaleArray ;

Loading…
취소
저장