[ 'id' => 1, 'name' => 'Account Balance', //余额购买 'label' => 'cash', ], // 2 => [ // 'id' => 2, // 'name' => '复消兑换', // ], // 3 => [ // 'id' => 3, // 'name' => '兑换点数', // 'label' => 'exchange', // ], 4 => [ 'id' => 4, 'name' => 'Travel Bonus', 'label' => 'tourism_points', ], 5 => [ 'id' => 5, 'name' => 'Car Fund', 'label' => 'garage_points', ], 6 => [ 'id' => 6, 'name' => 'Villa Fund', 'label' => 'villa_points', ], 7 => [ 'id' => 7, 'name' => 'PayStack', 'label' => 'pay_stack', ], ]; const GOODS_TYPE = [ 1 =>[ 'name'=>'国内商品',//国内商品 'discount'=>'50', ], 2 =>[ 'name'=>'进口商品',//进口商品 'discount'=>'60', ], ]; const GIFT_TYPE = [ 1 =>[ 'name'=>'Entry area',//报单区 ], 2 =>[ 'name'=>'Reselling area',//复消区 ], 3 =>[ 'name'=>'Office Entry area',//工作室报单 ], 4 =>[ 'name'=>'Office Reselling area',//工作室复消 ], ]; const STATUS_NAME = [ 1 => 'On sale',//已上架 0 => 'Sold out',//已下架 ]; const CATEGORY_TYPE = [ [ 'id' => 1, 'name' => 'Common products',//普通商品 'sell_type' => [ self::SALE_TYPE[1], // self::SALE_TYPE[3], self::SALE_TYPE[7], ] ], // [ // 'id' => 4, // 'name' => 'Travel bonus products',//旅游积分商品 // 'sell_type' => [ // self::SALE_TYPE[4] // ] // ], [ 'id' => 5, 'name' => 'Car Fund Products', 'sell_type' => [ self::SALE_TYPE[5] ] ], [ 'id' => 6, 'name' => 'Villa Fund Products', 'sell_type' => [ self::SALE_TYPE[6] ] ], ]; /** * @inheritdoc */ public static function tableName() { return '{{%SHOP_GOODS}}'; } /** * @inheritdoc */ public function rules() { return [ [['SELL_DISCOUNT','GOODS_NAME', 'CATE_ID','GIFT_TYPE', 'GOODS_NO', 'SELL_PRICE','MARKET_PRICE','PRICE_PV','STORE_NUMS', 'SELL_TYPE', 'CATEGORY_TYPE', 'SELL_PRICE_STANDARD', 'TAX_RATE'], 'required'], [['STORE_NUMS'], 'integer'], [['SELL_PRICE','MARKET_PRICE','PRICE_PV','POINT',/* 'SELL_TYPE',*/ 'CATEGORY_TYPE' ,'SELL_PRICE_STANDARD', 'TAX_RATE'], 'number'], [['ID','CATE_ID', 'GOODS_NO','GIFT_TYPE'], 'string', 'max' => 32], [['UNIT'], 'string', 'max' => 16], [['COVER', 'GOODS_NAME'], 'string', 'max' => 255], [['IMAGES','CONTENT'], 'string', 'max' => 4000], [['GOODS_NAME'], 'unique'], [['ID'], 'unique'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'ID' => 'ID', 'GOODS_NAME' => '商品名称', 'CATE_ID' => '所属分类ID', // 'TYPE' => '商品来源', 'SELL_DISCOUNT' => '会员折扣', 'GIFT_TYPE' => '商品类型', 'CATEGORY_TYPE' => '商品分类', 'SELL_TYPE' => '出售方式', 'GOODS_NO' => '商品编号', 'UNIT' => '商品单位', 'COVER' => '商品封面', 'IMAGES' => '商品图片', 'CONTENT' => '商品内容', 'SELL_PRICE' => '销售价格', 'SELL_PRICE_STANDARD' => 'US price($)', 'MARKET_PRICE' => '市场价格', 'PRICE_PV' => '价格PV', 'TAX_RATE' => '税率', 'TAX_AMOUNT' => '税额', // 'POINT' => '兑换积分', 'STORE_NUMS' => '库存', 'STATUS' => '是否上架', 'IS_DEL' => '是否删除', 'CREATED_AT' => '创建时间', 'UPDATED_AT' => '更新时间', 'DELETED_AT' => '更新时间', 'SORT' => '排序', ]; } /** * 判断提现状态 * @param $nowStatus * @param $toStatus * @return string */ public static function chkAuditStatus($nowStatus, $toStatus) { $statusName = self::STATUS_NAME; $msg = 'The current product status is【' . $statusName[$nowStatus] . '】,cannot be set to【' . $statusName[$toStatus] . '】';// 当前商品状态为 无法设置为 switch ($toStatus) { // 下架 case 0: if ($nowStatus == 1) { $msg = ''; } break; //上架 case 1: if ($nowStatus == 0) { $msg = ''; } break; default: } return $msg; } /** * 支付方式 * @return array */ public static function payTypes(){ return [ 'cash'=>[ 'name'=>'Ecoin' //余额支付 ], // 'point'=>[ // 'name'=>'积分支付' //积分支付 // ], // 'exchange' => [ // 'name' => '积分点数' // ], // 'tourism_points'=>[ // 'name'=>'Travel Bonus' // ], 'garage_points' => [ 'name' => 'Car Fund' ], 'villa_points' => [ 'name' => 'Villa Fund' ], 'pay_stack' => [ 'name' => 'PayStack' ], ]; } }