Commit 3c42df69 authored by luhongguang's avatar luhongguang

Merge branch 'develop' of https://git.yidian-inc.com:8021/bp/goods into develop

parents 95f7b8b6 c6a6b6e6
......@@ -12,7 +12,7 @@ class MarketingException extends BaseException
protected $cus = [
0 => '活动名称不能为空',
1 => '活动名称不能大于40',
1 => '活动名称不能大于50',
2 => '活动名称不合法',
3 => '(一级)佣金率不能为空',
4 => '(二级)佣金率不能为空',
......
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class QyqGroupleader extends MysqlBase
{
const TABLE_NAME = 'qyq_groupleader';
const CONFIG_INDEX = 'goods';
const PRIMARY_KEY = 'id';
public static function getRecord($where, $colums = [])
{
if (empty($colums)) {
$colums = '*';
}
return self::get($colums, $where);
}
public static function getRecordMaster($where, $colums = [])
{
if (empty($colums)) {
$colums = '*';
}
return self::selectMaster($colums, $where);
}
public static function insertRecord($colums)
{
return self::insert($colums);
}
public static function updateRecord($colums, $where)
{
return self::update($colums, $where);
}
public static function save($data, $where = [])
{
if (empty($where)) {
return self::insert($data);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
public static function getRecords($where, $colums = [])
{
if (empty($colums)) {
$colums = '*';
}
return self::select($colums, $where);
}
public static function getCount($where, $columns = "*")
{
if (empty($columns)) {
$columns = '*';
}
return self::count($columns, $where);
}
}
......@@ -9,6 +9,12 @@ use \Validate\CheckIsDistributorValidate;
class DistributorController extends Base
{
public function importAction()
{
$distributionList = DistributorService::import();
print_r($distributionList);
}
/**
* 二级团长列表
*
......
......@@ -1195,6 +1195,9 @@ class GoodsService
$where['goods_sku_id'] = $params['goods_sku_id'];
}
$info = GoodsSku::getRecord($where);
$info['original_price'] = $info['original_price']/100;
$info['price'] = $info['price']/100;
$info['desc_pic_url'] = self::getUrlList($info['desc_pic_url']);
$info['introduce_pic_url'] = self::getUrlList($info['introduce_pic_url']);
return $info;
......
......@@ -4,6 +4,7 @@
namespace App\Services\marketing;
use App\Models\marketing\mysql\Distributor;
use App\Models\marketing\mysql\QyqGroupleader;
use App\Models\marketing\mysql\DistributorAuditRecord;
use Api\PhpUtils\Validate\Validate;
use Api\PhpServices\Idgen\Idgen;
......@@ -17,7 +18,36 @@ use Api\PhpServices\ShopImage\QR;
use App\Exception\custom\InterfaceException;
class DistributorService
{
{
public static function import()
{
$list = QyqGroupleader::getRecords(['status[>=]' => 0]);
foreach ($list as $key => $value) {
$userId = $value['userId'];
if (empty($value['parentUserId'])) {
$distributorType = 1;
} else {
$distributorType = 2;
}
$distributorData = [
'parent_user_id' => $value['parentUserId'],
'user_id' => $userId,
'distributor_code' => '',
'distributor_type' => $distributorType, //1申请团长,2申请二级团长
'user_name' => $value['userName'],
'create_time' => $value['createTime'],
'update_time' => $value['updateTime'],
];
Distributor::insertRecord($distributorData);
}
echo "成功";
}
/**
* 查询二级团长
*
......
......@@ -165,9 +165,9 @@ class MarketingService
throw new MarketingException(['cus'=>3]);
}
if (empty($secondCommissionRate)) {
throw new MarketingException(['cus'=>4]);
}
// if (empty($secondCommissionRate)) {
// throw new MarketingException(['cus'=>4]);
// }
if (self::utf8Strlen($marketingName) > 50) {
throw new MarketingException(['cus'=>1]);
......
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