This commit is contained in:
mkm 2024-01-21 18:44:58 +08:00
parent 20b60461bf
commit fff61c55ab
4 changed files with 21 additions and 65 deletions

View File

@ -301,10 +301,12 @@ class StoreProduct extends BaseController
$this->repository->updates($ids,$data);
return app('json')->success('修改成功');
}
public function copy(){
$product=$this->repository->getAdminOneProduct(6300,0);
//**复制商品 */
public function copy($product_id=0,$mer_id=0){
if($product_id==0) return app('json')->fail('参数错误');
$product=$this->repository->getAdminOneProduct($product_id,0);
$product = $product->toArray();
$product['mer_id']=113;
$product['mer_id']=$mer_id;
$product['old_product_id']=$product['product_id'];
return $this->repository->create($product, 0,1);

View File

@ -653,12 +653,7 @@ class Common extends BaseController
$imageInfo = null;
}
if (!$imageInfo) {
$imageInfo = app()->make(QrcodeService::class)->getQRCodePath($data['code'], $name,['code'=>[
'r' => 255,
'g' => 221,
'b' => 167,
'a' => 0,
]]);
$imageInfo = app()->make(QrcodeService::class)->getQRCodePath($data['code'], $name,['code'=>1]);
if (is_string($imageInfo)) throw new ValidateException('二维码生成失败');
$imageInfo['dir'] = tidy_url($imageInfo['dir'], null, $siteUrl);

View File

@ -30,60 +30,7 @@ class Demo extends BaseController
{
public function index()
{
$data=[
6923644264192,
6923644210151,
6921665735042,
6921665731693,
6921665731679,
6921665730825,
6921665707940,
6921665701054,
6920208995349,
6920208986163,
6920208960866,
6920208960064,
6920208924394,
6920208924035,
6920208924011,
6919188019961,
6919188019961,
6908791503943,
6908791006024,
6907992507385,
];
$mer_id=167;
foreach ($data as $item) {
$store_product_attr_value=Db::name('store_product_attr_value')->alias('a')
->join('store_product b','a.product_id=b.product_id and b.product_type=98')
->where('a.bar_code',$item)->value('a.product_id');
if($store_product_attr_value){
$find=Db::name('store_product_attr_value')->alias('a')
->join('store_product b','a.product_id=b.product_id and b.product_type=0 and b.mer_id='.$mer_id)
->where('a.bar_code',$item)->field('a.product_id,b.cate_id')->find();
if($find){
$cloud_product=Db::name('cloud_product')->where('product_id',$find['product_id'])->where('mer_id',$mer_id)->value('product_id');
if(!$cloud_product){
$source_mer_id = Db::name('store_product')->where('product_id', $store_product_attr_value)->value('mer_id');
$datas = [
'product_id' => $find['product_id'],
'cate_id' => $find['cate_id'],
'mer_id' => $mer_id,
'source_mer_id' => $source_mer_id,
'street_code' => 510521107,
'type_id' => 17,
'category_id' => 2566,
'weight' => 1,
'status' => 1,
'create_time' => date('Y-m-d H:i:s'),
'mer_labels' =>'',
];
Db::name('cloud_product')->insert($datas);
}
}
}
}
halt(1);
$mer_id = 104;
$file = request()->file('file');

View File

@ -41,10 +41,22 @@ class QrcodeService
if (!$siteUrl) return '请前往后台设置->系统设置->网站域名 填写您的域名格式为http://域名';
$info = [];
$outfile = Config::get('qrcode.cache_dir');
$code = new QrCode($url);
$code = new QrCode();
if(isset($data['code'])){
$code->setForegroundColor($data['code']);
$code->setForegroundColor([
'r' => 248,
'g' => 150,
'b' => 46,
'a' => 0,
]);
$code->setBackgroundColor([
'r' => 255,
'g' => 246,
'b' => 235,
'a' => 0,
]);
}
$code->setText($url);
if ($uploadType === 1) {
if (!is_dir('./public/' . $outfile))
mkdir('./public/' . $outfile, 0777, true);