Skip to content

Commit

Permalink
V1.3.3
Browse files Browse the repository at this point in the history
新增:获取电子面单发货
新增:开屏广告可设置每X天显示
新增:商品参数
新增:商品副标题
新增:公众号/小程序商城跳转其他小程序和超链接
优化:后台编辑新商品信息的步骤逻辑优化
优化:后台编辑商品详情,可从素材库多选图片上传
优化:待发货订单支持按单个商品或整个订单申请仅退款,并支持退运费
修复:单规格商品手机端显示空白规格问题
修复:任务-完善个人信息后引导内容仍然显示问题
修复:商品评价时间,后台和手机端不一致问题
  • Loading branch information
Andy0520 authored and wj005 committed Jul 26, 2021
1 parent aacd3eb commit bd0765b
Show file tree
Hide file tree
Showing 268 changed files with 2,616 additions and 683 deletions.
2 changes: 1 addition & 1 deletion api/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function actionIndex()
} else {
$package['plugins'] = [
'live-player-plugin' => [
'version' => '1.3.0',
'version' => '1.3.1',
'provider' => 'wx2b03c6e691cd7370'
]
];
Expand Down
10 changes: 10 additions & 0 deletions api/GoodsargsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace leadmall\api;

use leadmall\Map;
use goods\api\ArgsController as GoodsargsModules;

class GoodsargsController extends GoodsargsModules implements Map
{

}
13 changes: 13 additions & 0 deletions api/WaybillController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php


namespace leadmall\api;


use leadmall\Map;
use setting\api\WaybillController as WaybillModules;

class WaybillController extends WaybillModules implements Map
{

}
2 changes: 1 addition & 1 deletion app/PayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function paid($value)
if ($model && $model->status < 201) {
$model->status = 201;
$model->pay_number = $pay_number;
$model->pay_type = 'wechat';
$model->pay_type = $pay_type;
$model->pay_time = time();

Yii::info('判断插件是否安装' . $this->plugins("task", "status"));
Expand Down
Binary file modified applet/app.zip
Binary file not shown.
191 changes: 191 additions & 0 deletions components/Waybill.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<?php
/**
* @copyright ©2020 浙江禾成云计算有限公司
* Created by PhpStorm.
* User: Andy - 阿德 [email protected]
* Date: 2021/6/29
* Time: 17:54
*/

namespace app\components;

use app\components\express\BaseExpress;
use GuzzleHttp\Exception\TransferException;
use order\models\Order;

class Waybill extends BaseExpress
{
//测试地址 上线需更换
protected $url = 'https://kop.kuaidihelp.com/test';

/**@var \setting\models\Waybill $waybill 电子面单设置*/
protected $waybill;
/**@var Order $order 订单*/
protected $order;
/**@var string $orderSn 订单编号,必须唯一 */
protected $orderSn;
/**@var string $shipperType 快递公司标识符,如:zt 。*/
protected $shipperType;
/**@var string $siteFlag 快递网点名称(申通必填)*/
protected $siteFlag;
/**@var int $payType 支付方式 :1-寄方支付,2-收方支付,3-月结(支持EMS、邮政快递包裹、邮政标准快递和顺丰速运)*/
protected $payType = 1;
/**@var string $tradeName 商品名称(最多50个字符)*/
protected $tradeName;
/**@var string $bName 寄件方信息列表*/
protected $bName;
/**@var $bMobile string 手机号码*/
protected $bMobile;
/**@var string $bProvince 寄件方所在省名称,如果所在省有省字,则不能略 */
protected $bProvince;
/**@var string $bCity 寄件方所在省名称,如果所在省有省字,则不能略 */
protected $bCity;
/**@var string $bDistrict 寄件方所在地区(区/县/镇) */
protected $bDistrict;
/**@var string $bAddress 寄件方地址 */
protected $bAddress;

/**@var string $name 收件方信息列表*/
protected $name;
/**@var $mobile string 收件方手机号码*/
protected $mobile;
/**@var string $province 收件方所在省名称,如果所在省有省字,则不能略 */
protected $province;
/**@var string $city 收件方所在省名称,如果所在省有省字,则不能略 */
protected $city;
/**@var string $district 收件方所在地区(区/县/镇) */
protected $district;
/**@var string $address 收件方地址 */
protected $address;

/**@var string $customerName 大客户账号*/
protected $customerName;
/**@var string $customerPassword 大客户密码*/
protected $customerPassword;

public function wrap($param)
{
if (!isset($param['order_sn']) || !isset($param['waybill_id'])) {
Error('参数不完整');
}
$this->order = Order::find()->with(['buyer', 'freight', 'goods'])->where(['order_sn' => $param['order_sn']])->one();
if (!$this->order) {
Error('订单不存在');
}
$this->waybill = \setting\models\Waybill::findOne(['id' => $param['waybill_id'], 'is_deleted' => 0]);
if (!$this->waybill) {
Error('电子面单未配置');
}
$this->orderSn = $this->order->order_sn;
if ($this->shipperType == 'sto') {
if (!isset($param['site_flag'])) {
Error('快递网点名称(申通必填)');
} else {
$this->siteFlag = $param['site_flag'];
}
}
$goodsNameList = $this->order->goods;
$goodsName = '';
foreach ($goodsNameList as $v) {
$goodsName .= $v['goods_name'] . ';';
}
$goodsName = rtrim($goodsName, ';');
if (mb_strlen($goodsName) > 50) {
$goodsName = mb_substr($goodsName, 0, 47);
$goodsName .= '...';
}
$this->tradeName = $goodsName;
//寄件人信息
$this->bName = $this->waybill->name;
$this->bMobile = $this->waybill->mobile;
$this->bProvince = $this->waybill->province;
$this->bCity = $this->waybill->city;
$this->bDistrict = $this->waybill->district;
$this->bAddress = $this->waybill->address;
$this->shipperType = $this->waybill->code;

//收件人信息
$this->name = $this->order->buyer->name;
$this->mobile = $this->order->buyer->mobile;
$this->province = $this->order->buyer->province;
$this->city = $this->order->buyer->city;
$this->district = $this->order->buyer->district;
$this->address = $this->order->buyer->address;

//大客户账号密码
$this->customerName = $this->waybill->customer_name ?? '';
$this->customerPassword = $this->waybill->customer_password ?? '';
}

public function getResult()
{
$params = [
'order_id' => $this->orderSn,
'shipper_type' => $this->shipperType,
'pay_type' => $this->payType,
'trade_name' => $this->tradeName,
'sender' => [
'name' => $this->bName,
'mobile' => $this->bMobile,
'province' => $this->bProvince,
'city' => $this->bCity,
'district' => $this->bDistrict,
'address' => $this->bAddress
],
'recipient' => [
'name' => $this->name,
'mobile' => $this->mobile,
'province' => $this->province,
'city' => $this->city,
'district' => $this->district,
'address' => $this->address
],
'customer_name' => $this->customerName,
'customer_password' => $this->customerPassword
];
$config = $this->getConfig();
if (!isset($config['app_id']) || empty($config['app_key'])) {
Error('请配置快宝开放平台');
}
$header = [
'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8',
];
$method = 'account.waybill.get';
$time = time();
$body = [
"app_id" => $config['app_id'],
"method" => $method,
"sign" => md5($config['app_id'] . $method . $time . $config['app_key']),
"ts" => $time,
"data" => json_encode($params)
];
try {
return $this->post($this->url, $body, $header);
} catch (TransferException $e) {
$httpCode = $e->getResponse()->getStatusCode();
$headers = $e->getResponse()->getHeaders();
$msg = [
'code' => $httpCode,
'header' => $headers,
'msg' => '"参数名错误 或 其他错误"',
];
$this->returnError($msg);
} catch (\Exception $e) {
$this->returnError($e->getMessage());
}
}

public function parseResult($content)
{
return $content;
}

protected function returnError($msg)
{
\Yii::$app->response->data = [
'code' => -1,
'message' => $msg
];
\Yii::$app->end();
}
}
107 changes: 107 additions & 0 deletions components/WaybillPrint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php

namespace app\components;

use GuzzleHttp\Exception\TransferException;

class WaybillPrint extends Waybill
{
protected $url = 'https://kop.kuaidihelp.com/api';

/**@var string $agentId 目标云打印机的访问密钥*/
protected $agentId;
/**@var int $printType 打印类型,1:仅生成底单,jpg格式; 2:仅打印; 3:打印并生成jpg格式底单; 7:仅生成底单,pdf格式;默认为3*/
protected $printType = 3;

public function getResult()
{
$params = [
'print_type' => $this->printType,
'print_data' => [
[
'tid' => $this->orderSn,
'waybill_code' => '',
'cp_code' => $this->shipperType,
'sender' => [
'name' => $this->bName,
'mobile' => $this->bMobile,
'phone' => $this->bMobile,
'address' => [
'province' => $this->bProvince,
'city' => $this->bCity,
'district' => $this->bDistrict,
'detail' => $this->bAddress
]
],
'recipient' => [
'name' => $this->name,
'mobile' => $this->mobile,
'phone' => $this->mobile,
'address' => [
'province' => $this->province,
'city' => $this->city,
'district' => $this->district,
'detail' => $this->address
]
],
'routing_info' => [],
'goods_name' => $this->tradeName
]
],
];
$config = $this->getConfig();
if (!isset($config['app_id']) || empty($config['app_key']) || empty($config['agent_id'])) {
Error('请配置快宝开放平台');
}
$params['agent_id'] = $config['agent_id'];
$header = [
'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8',
];
$method = 'cloud.print.waybill';
$time = time();
$body = [
"app_id" => $config['app_id'],
"method" => $method,
"sign" => md5($config['app_id'] . $method . $time . $config['app_key']),
"ts" => $time,
"data" => json_encode($params)
];
try {
return $this->post($this->url, $body, $header);
} catch (TransferException $e) {
$httpCode = $e->getResponse()->getStatusCode();
$headers = $e->getResponse()->getHeaders();
$msg = [
'code' => $httpCode,
'header' => $headers,
'msg' => '"参数名错误 或 其他错误"',
];
$this->returnError($msg);
} catch (\Exception $e) {
$this->returnError($e->getMessage());
}
}

public function parseResult($content)
{
if ($content['code'] == 221009) {
Error($content['data'][$this->orderSn]['message']);
}
if ($content['code'] != 0) {
Error($content['msg']);
}
if ($content['data'][$this->orderSn]['status'] == 'success') {
return [
'freight_sn' => $content['data'][$this->orderSn]['task_info']['waybill_code'] ?? '',
'preview_image' => $content['data'][$this->orderSn]['preview_image'] ?? ''
];
} elseif ($content['data'][$this->orderSn]['status'] == 'failure') {
if ($content['data'][$this->orderSn]['message'] == '已有相同tid的任务在执行,请30秒后重试') {
Error('频繁获取电子面单,请30秒后重试');
}
Error($content['data'][$this->orderSn]['message']);
} else {
Error('获取电子面单出错');
}
}
}
2 changes: 1 addition & 1 deletion components/express/BaseExpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ protected function getConfig()
if ($config) {
return json_decode($config['content'], true);
}
Error('请配置物流接口');
Error('请配置快宝开放平台');
}
}
1 change: 1 addition & 0 deletions config/aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'@coupon/api' => '@leadmall/modules/coupon/api',
'@collect/api' => '@leadmall/modules/collect/api',
'@live/api' => '@leadmall/modules/live/api',
'@waybill/api' => '@leadmall/modules/waybill/api',

'@demo/app' => '@leadmall/modules/demo/app',
'@basics/app' => '@leadmall/modules/basics/app',
Expand Down
22 changes: 22 additions & 0 deletions forms/install/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ CREATE TABLE `heshop_initialize_prefix_order_after` (
`source` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '来源',
`return_number` int(10) NOT NULL DEFAULT 1 COMMENT '退货数量',
`return_amount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '退款金额',
`return_freight` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '退款运费',
`images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '说明图片',
`status` smallint(3) NOT NULL DEFAULT 100 COMMENT '100待审核 101首次拒绝 102再次提交待审核 111审核通过待退款 121审核通过待买家发货 122买家发货待商家收货退款 131审核通过待买家发货 132买家发货待商家收货 133商家换货(买家待收) 200售后已完成 201两次拒绝之后完成',
`return_address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '退货地址',
Expand Down Expand Up @@ -1076,3 +1077,24 @@ CREATE TABLE `heshop_initialize_prefix_task_user` (
`deleted_time` int(10) DEFAULT '0' COMMENT '删除时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8mb4;

CREATE TABLE `heshop_initialize_prefix_waybill` (
`id` bigint(10) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`code` varchar(10) NOT NULL COMMENT '物流公司编号',
`name` varchar(256) NOT NULL COMMENT '名称',
`mobile` varchar(32) NOT NULL COMMENT '联系方式',
`province` varchar(50) NOT NULL COMMENT '',
`city` varchar(50) NOT NULL COMMENT '',
`district` varchar(50) NOT NULL COMMENT '区县',
`address` varchar(255) NOT NULL COMMENT '详细地址',
`AppID` varchar(50) NOT NULL COMMENT '应用ID',
`merchant_id` bigint(10) NOT NULL COMMENT '商户ID',
`created_time` int(10) DEFAULT '0' COMMENT '创建时间',
`updated_time` int(10) DEFAULT '0' COMMENT '更新时间',
`deleted_time` int(10) DEFAULT '0' COMMENT '删除时间',
`is_deleted` tinyint(100) DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4;

ALTER TABLE `heshop_initialize_prefix_order_after`
ADD COLUMN `return_freight` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '退款运费' ;
Loading

0 comments on commit bd0765b

Please sign in to comment.