Commit 4349eaac authored by 姚书霞's avatar 姚书霞 🐘

电子围栏接口

parent 778b8121
...@@ -99,12 +99,11 @@ class ShopUserMembergradeController extends BaseController ...@@ -99,12 +99,11 @@ class ShopUserMembergradeController extends BaseController
public function actionMembergradeAdd() public function actionMembergradeAdd()
{ {
$model = new $this->modelClass(); $model = new $this->modelClass();
$model->scenario = 'create';//创建的场景
$other_param = array( $other_param = array(
'GUID'=>Func::create_guid(), 'GUID'=>Func::create_guid(),
'ORG_GUID'=>Yii::$app->user->identity->ORG_GUID, 'ORG_GUID'=>Yii::$app->user->identity->ORG_GUID,
); );
$model->setAttributes($other_param); $model->setAttributes($other_param,false);
$model->setAttributes(Yii::$app->getRequest()->post()); $model->setAttributes(Yii::$app->getRequest()->post());
......
...@@ -81,7 +81,7 @@ use app\models\v1\branch\ShopCityDistributionSetting; ...@@ -81,7 +81,7 @@ use app\models\v1\branch\ShopCityDistributionSetting;
* @property int $IS_B2C 是否B2C门店 1是 * @property int $IS_B2C 是否B2C门店 1是
* @property int $TOTAL_VOLUME 门店销量 * @property int $TOTAL_VOLUME 门店销量
* *
* @property ShopCityDistributionSetting[] $shopCityDistributionSettings * @property CityDistributionSettings[] $CityDistributionSettings
*/ */
class ShopBranch extends BaseModel class ShopBranch extends BaseModel
{ {
...@@ -245,7 +245,7 @@ class ShopBranch extends BaseModel ...@@ -245,7 +245,7 @@ class ShopBranch extends BaseModel
/** /**
* @return \yii\db\ActiveQuery * @return \yii\db\ActiveQuery
*/ */
public function getShopCityDistributionSettings() public function getCityDistributionSettings()
{ {
return $this->hasMany(ShopCityDistributionSetting::className(), ['BRANCH_GUID' => 'GUID']); return $this->hasMany(ShopCityDistributionSetting::className(), ['BRANCH_GUID' => 'GUID']);
} }
......
<?php
namespace app\models\v1\branch;
use Yii;
use app\models\v1\BaseModel;
use app\models\v1\branch\ShopCityDistributionSetting;
/**
* This is the model class for table "shop_city_distribution_region".
*
* @property string $GUID 电子围栏GUID
* @property string $ORG_GUID 组织机构号
* @property string $CITY_DISTR_GUID 同城配送设置表,关联CITY_DISTRIBUTION_SETTING表GUID
* @property string $ORDEX 区域序号
* @property string $COLORS 区域颜色
* @property int $HF_TYPE 区域划分方式,1半径 2自定义
* @property string $REGION_R 划分方式为半径,存半径的值
* @property string $REGION_RANGE 划分方式自定义时,存数组值
* @property string $QS_PRICE 起送价格
* @property string $PS_PRICE 配送价格
* @property string $WEEK 配送时间周*
* @property int $IS_TYPE 配送时段和区域,1为区域,2为时间
*
* @property ShopCityDistributionSetting $CityDistributionSetting
*/
class ShopCityDistributionRegion extends BaseModel
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'shop_city_distribution_region';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['ORDEX', 'COLORS','HF_TYPE','REGION_R','REGION_RANGE','QS_PRICE','PS_PRICE'], 'required'],
[['HF_TYPE'], 'in', 'range' => [1, 2]],
[['REGION_R'], 'integer'],
[['REGION_RANGE'], 'string'],
[['QS_PRICE', 'PS_PRICE'], 'double'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'GUID' => 'Guid',
'ORG_GUID' => 'Org Guid',
'CITY_DISTR_GUID' => 'City Distr Guid',
'ORDEX' => 'Ordex',
'COLORS' => 'Colors',
'HF_TYPE' => 'Hf Type',
'REGION_R' => 'Region R',
'REGION_RANGE' => 'Region Range',
'QS_PRICE' => 'Qs Price',
'PS_PRICE' => 'Ps Price',
'WEEK' => 'Week',
'IS_TYPE' => 'Is Type',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCityDistributionSetting()
{
return $this->hasOne(ShopCityDistributionSetting::className(), ['GUID' => 'CITY_DISTR_GUID']);
}
}
...@@ -4,6 +4,7 @@ namespace app\models\v1\branch; ...@@ -4,6 +4,7 @@ namespace app\models\v1\branch;
use Yii; use Yii;
use app\models\v1\BaseModel; use app\models\v1\BaseModel;
use app\models\v1\branch\ShopBranch; use app\models\v1\branch\ShopBranch;
use app\models\v1\branch\ShopCityDistributionRegion;
/** /**
* This is the model class for table "shop_city_distribution_setting". * This is the model class for table "shop_city_distribution_setting".
...@@ -34,7 +35,7 @@ use app\models\v1\branch\ShopBranch; ...@@ -34,7 +35,7 @@ use app\models\v1\branch\ShopBranch;
* @property int $STATUS 是否开启同城配送,1:是 * @property int $STATUS 是否开启同城配送,1:是
* @property int $SETTING_TYPE 电子围栏类型:1:B2C范围,2:O2O范围 * @property int $SETTING_TYPE 电子围栏类型:1:B2C范围,2:O2O范围
* *
* @property CityDistributionRegion[] $cityDistributionRegions * @property ShopCityDistributionRegion[] $cityDistributionRegions
* @property ShopBranch $bRANCHGU * @property ShopBranch $bRANCHGU
*/ */
class ShopCityDistributionSetting extends BaseModel class ShopCityDistributionSetting extends BaseModel
...@@ -53,14 +54,11 @@ class ShopCityDistributionSetting extends BaseModel ...@@ -53,14 +54,11 @@ class ShopCityDistributionSetting extends BaseModel
public function rules() public function rules()
{ {
return [ return [
[['GUID'], 'required'], [['BRANCH_GUID','REGION_TYPE','SETTING_TYPE',], 'required'],
[['IS_OWN_DISTR', 'IS_OTHER_DISTR', 'IS_DADA_DISTR', 'IS_TIMING', 'TIME_SUBDIVISION', 'STATUS', 'SETTING_TYPE'], 'integer'], [['REGION_DISTR_DISTANCE', 'REGION_DISTR_PRICE','INCREASE_DISTANCE','INCREASE_PRICE'], 'double'],
[['SIMPLE_DISTR_QS_PRICE', 'SIMPLE_DISTR_PS_PRICE', 'REGION_DISTR_DISTANCE', 'REGION_DISTR_PRICE', 'INCREASE_DISTANCE', 'INCREASE_PRICE'], 'number'], [['STATUS'], 'boolean'],
[['GUID', 'ORG_GUID', 'BRANCH_GUID', 'WORK_TYPE', 'REGION_TYPE', 'ADDRESS', 'BOOKING_ORDER', 'MAX_BOOKING'], 'string', 'max' => 50], [['REGION_TYPE','SETTING_TYPE'], 'in', 'range' => [1, 2]],
[['SIMPLE_DISTR_NOTES', 'SIMPLE_DISTR_PIC'], 'string', 'max' => 200], // [['BRANCH_GUID'], 'exist', 'skipOnError' => true, 'targetClass' => ShopBranch::className(), 'targetAttribute' => ['BRANCH_GUID' => 'GUID']],
[['LAT', 'LNG'], 'string', 'max' => 20],
[['GUID'], 'unique'],
[['BRANCH_GUID'], 'exist', 'skipOnError' => true, 'targetClass' => ShopBranch::className(), 'targetAttribute' => ['BRANCH_GUID' => 'GUID']],
]; ];
} }
...@@ -103,7 +101,7 @@ class ShopCityDistributionSetting extends BaseModel ...@@ -103,7 +101,7 @@ class ShopCityDistributionSetting extends BaseModel
*/ */
public function getCityDistributionRegions() public function getCityDistributionRegions()
{ {
return $this->hasMany(CityDistributionRegion::className(), ['CITY_DISTR_GUID' => 'GUID']); return $this->hasMany(ShopCityDistributionRegion::className(), ['CITY_DISTR_GUID' => 'GUID']);
} }
/** /**
...@@ -177,7 +175,7 @@ class ShopCityDistributionSetting extends BaseModel ...@@ -177,7 +175,7 @@ class ShopCityDistributionSetting extends BaseModel
//门店下面的O2O和B2C设置,以及对应的区域 //门店下面的O2O和B2C设置,以及对应的区域
$select = "cds.GUID SETTING_GUID,cds.REGION_TYPE,cds.REGION_DISTR_DISTANCE,cds.REGION_DISTR_PRICE,cds.INCREASE_DISTANCE,cds.INCREASE_PRICE,"; $select = "cds.GUID SETTING_GUID,cds.REGION_TYPE,cds.REGION_DISTR_DISTANCE,cds.REGION_DISTR_PRICE,cds.INCREASE_DISTANCE,cds.INCREASE_PRICE,";
$select .= "cds.LAT,cds.LNG,cds.STATUS,cds.SETTING_TYPE,cdr.GUID REGION_GUID,cdr.CITY_DISTR_GUID,cdr.ORDEX,cdr.COLORS,"; $select .= "cds.STATUS,cds.SETTING_TYPE,cdr.GUID REGION_GUID,cdr.CITY_DISTR_GUID,cdr.ORDEX,cdr.COLORS,";
$select .= "cdr.HF_TYPE,cdr.REGION_R,cdr.REGION_RANGE,cdr.QS_PRICE,cdr.PS_PRICE,cdr.WEEK,cdr.IS_TYPE"; $select .= "cdr.HF_TYPE,cdr.REGION_R,cdr.REGION_RANGE,cdr.QS_PRICE,cdr.PS_PRICE,cdr.WEEK,cdr.IS_TYPE";
$setting_info = $this->find()->alias("cds") $setting_info = $this->find()->alias("cds")
->select($select) ->select($select)
...@@ -198,8 +196,6 @@ class ShopCityDistributionSetting extends BaseModel ...@@ -198,8 +196,6 @@ class ShopCityDistributionSetting extends BaseModel
$b2c['REGION_DISTR_PRICE'] = $value['REGION_DISTR_PRICE']; $b2c['REGION_DISTR_PRICE'] = $value['REGION_DISTR_PRICE'];
$b2c['INCREASE_DISTANCE'] = $value['INCREASE_DISTANCE']; $b2c['INCREASE_DISTANCE'] = $value['INCREASE_DISTANCE'];
$b2c['INCREASE_PRICE'] = $value['INCREASE_PRICE']; $b2c['INCREASE_PRICE'] = $value['INCREASE_PRICE'];
$b2c['LAT'] = $value['LAT'];
$b2c['LNG'] = $value['LNG'];
$b2c['STATUS'] = $value['STATUS']; $b2c['STATUS'] = $value['STATUS'];
$b2c['SETTING_TYPE'] = $value['SETTING_TYPE']; $b2c['SETTING_TYPE'] = $value['SETTING_TYPE'];
$b2c['REGION'] = []; $b2c['REGION'] = [];
...@@ -243,8 +239,6 @@ class ShopCityDistributionSetting extends BaseModel ...@@ -243,8 +239,6 @@ class ShopCityDistributionSetting extends BaseModel
$o2o['REGION_DISTR_PRICE'] = $value['REGION_DISTR_PRICE']; $o2o['REGION_DISTR_PRICE'] = $value['REGION_DISTR_PRICE'];
$o2o['INCREASE_DISTANCE'] = $value['INCREASE_DISTANCE']; $o2o['INCREASE_DISTANCE'] = $value['INCREASE_DISTANCE'];
$o2o['INCREASE_PRICE'] = $value['INCREASE_PRICE']; $o2o['INCREASE_PRICE'] = $value['INCREASE_PRICE'];
$o2o['LAT'] = $value['LAT'];
$o2o['LNG'] = $value['LNG'];
$o2o['STATUS'] = $value['STATUS']; $o2o['STATUS'] = $value['STATUS'];
$o2o['SETTING_TYPE'] = $value['SETTING_TYPE']; $o2o['SETTING_TYPE'] = $value['SETTING_TYPE'];
$o2o['REGION'] = []; $o2o['REGION'] = [];
......
...@@ -77,8 +77,6 @@ class ShopUserMembergrade extends BaseModel ...@@ -77,8 +77,6 @@ class ShopUserMembergrade extends BaseModel
[['IS_SETRANGE'], 'in', 'range' => [0, 1, 2]], [['IS_SETRANGE'], 'in', 'range' => [0, 1, 2]],
[['NAME'], 'string', 'max' => 20], [['NAME'], 'string', 'max' => 20],
[['GUID'], 'required','on'=>'update'], [['GUID'], 'required','on'=>'update'],
[['GUID'], 'safe','on'=>'create'],
[['ORG_GUID'], 'safe'],
]; ];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment