Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
goods
Commits
4bc152d8
Commit
4bc152d8
authored
Jul 07, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.yidian-inc.com/bp/goods
into develop
parents
eba22b17
a0bdd0a2
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
123 additions
and
32 deletions
+123
-32
GoodsException.php
application/exception/custom/GoodsException.php
+1
-0
GoodsInitShopValidate.php
application/library/Validate/GoodsInitShopValidate.php
+23
-0
GoodsToInit.php
application/modules/Cli/controllers/GoodsToInit.php
+31
-6
Goods.php
application/modules/Goods/controllers/Goods.php
+13
-0
GoodsService.php
application/services/goods/GoodsService.php
+30
-7
RedisSession.php
vendor/api/php_services/src/Session/RedisSession.php
+3
-2
RedisSessionHandler.php
vendor/api/php_services/src/Session/RedisSessionHandler.php
+4
-3
FileLog.php
vendor/api/php_utils/src/Log/FileLog.php
+2
-2
InstalledVersions.php
vendor/composer/InstalledVersions.php
+4
-4
autoload_classmap.php
vendor/composer/autoload_classmap.php
+2
-0
autoload_static.php
vendor/composer/autoload_static.php
+2
-0
installed.json
vendor/composer/installed.json
+4
-4
installed.php
vendor/composer/installed.php
+4
-4
No files found.
application/exception/custom/GoodsException.php
View file @
4bc152d8
...
...
@@ -39,5 +39,6 @@ class GoodsException extends BaseException
25
=>
'开始时间格式不对'
,
26
=>
'结束时间格式不对'
,
27
=>
'TCC调用失败'
,
28
=>
'上架状态不能编辑,需先下架,再做编辑操作'
,
];
}
\ No newline at end of file
application/library/Validate/GoodsInitShopValidate.php
0 → 100644
View file @
4bc152d8
<?php
namespace
Validate
;
/**
* Class GoodsInitShopValidate
*
* @package Validate
*/
class
GoodsInitShopValidate
extends
BaseValidate
{
protected
$rule
=
[
'life_account_id'
=>
'require'
,
'merchant_id'
=>
'require'
,
];
protected
$message
=
[
"life_account_id"
=>
"生活号id不能为空"
,
"merchant_id"
=>
"商户id不能为空"
,
];
}
\ No newline at end of file
application/modules/Cli/controllers/GoodsToInit.php
View file @
4bc152d8
...
...
@@ -61,18 +61,26 @@ class GoodsToInitController extends Cli
}
/**
* 脚本第一步,把所有的
* 脚本第一步,把所有的
shop数据处理
*/
private
function
dealShopData
(
$list
)
{
echo
"开始处理 shop 数据
\n
"
;
foreach
(
$list
as
$item
)
{
if
(
empty
(
$item
[
"lifeAccountId"
]))
{
// echo $item["userId"] . "没有生活号id \n";
continue
;
$userId
=
$item
[
"userId"
];
$accountRes
=
$this
->
getLifeAccountIdAndMerchantId
(
$userId
);
if
(
!
empty
(
$accountRes
))
{
$lifeAccountId
=
$accountRes
[
"life_account_id"
];
$merchantId
=
$accountRes
[
"merchant_id"
];
}
else
{
}
}
else
{
$lifeAccountId
=
$item
[
"lifeAccountId"
];
$merchantId
=
$this
->
getMerchantId
(
$lifeAccountId
);
}
if
(
empty
(
$merchantId
))
{
// echo "生活号 ".$lifeAccountId." 没有对应的 merchant_id \n";
continue
;
...
...
@@ -124,6 +132,23 @@ class GoodsToInitController extends Cli
return
empty
(
$lifeAccountRes
[
"response"
][
"result"
][
"merchant_id"
])
?
""
:
$lifeAccountRes
[
"response"
][
"result"
][
"merchant_id"
];
}
/**
*
* @param $userId
* @return array|mixed
* @throws InterfaceException
*/
private
function
getLifeAccountIdAndMerchantId
(
$userId
)
{
$url
=
config
(
'interface'
,
'merchant.lifeaccount.get_lid_by_uid'
);
if
(
empty
(
$url
))
{
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
$res
=
(
new
Request
())
->
get
(
$url
,
[
"uid"
=>
$userId
]);
return
empty
(
$res
[
"response"
][
"result"
][
0
])
?
[]
:
$res
[
"response"
][
"result"
][
0
];
}
/**
* 添加门店数据
* @param $data
...
...
@@ -180,7 +205,7 @@ class GoodsToInitController extends Cli
$expirationTime
=
$item
[
"outDate"
];
$ruleLimit
=
$item
[
"canBuy"
];
$ruleDesc
=
$item
[
"ruleIntroduce"
];
$ruleRefund
=
$item
[
"useRule"
];
$ruleRefund
=
empty
(
$item
[
"useRule"
])
?
1
:
$item
[
"useRule"
];
$ruleDateType
=
$item
[
"holidayUse"
]
==
0
?
2
:
1
;
$ruleStartTime
=
$item
[
"starTime"
];
$ruleEndTime
=
$item
[
"endTime"
];
...
...
application/modules/Goods/controllers/Goods.php
View file @
4bc152d8
...
...
@@ -13,6 +13,7 @@ use \Validate\GoodsListCValidate;
use
\Validate\OrderGoodsValidate
;
use
\Validate\GoodsOnlineOfflineValidate
;
use
\Validate\PaySuccessGoodsCallbackValidate
;
use
\Validate\GoodsInitShopValidate
;
use
\App\Services\goods\ElasticGoodService
;
...
...
@@ -246,4 +247,16 @@ class GoodsController extends Base
$this
->
success
([
"result"
=>
$res
]);
}
/**
* 初始化 shop_id
* @throws \App\Exception\custom\GoodsException
*/
public
function
init_shopAction
()
{
(
new
GoodsInitShopValidate
())
->
validate
();
$params
=
$this
->
params
;
$shopId
=
GoodsService
::
initShop
(
$params
);
$this
->
success
([
"result"
=>
[
"shop_id"
=>
$shopId
]]);
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
4bc152d8
...
...
@@ -529,6 +529,10 @@ class GoodsService
*/
private
static
function
editGoodsSku
(
$goodsSkuId
,
$skuData
,
$params
=
[])
{
$skuInfo
=
GoodsSku
::
getRecord
([
"goods_sku_id"
=>
$goodsSkuId
]);
if
(
$skuInfo
[
"online_status"
]
==
GoodsSku
::
ONLINE_STATUS_ONLINE
)
{
throw
new
GoodsException
([
'cus'
=>
28
]);
}
if
(
$params
[
"expiration_time"
]
<
date
(
"Y-m-d H:i:s"
))
{
throw
new
GoodsException
([
'cus'
=>
16
]);
}
...
...
@@ -1260,15 +1264,19 @@ class GoodsService
foreach
(
$strList
as
$key
=>
$str
)
{
$arr
=
explode
(
"/"
,
$str
);
if
(
count
(
$arr
)
!=
2
)
{
if
(
preg_match
(
"/^http[s]
{
0,1
}
:\/\/([\w.]+\/?)\S*/"
,
$str
))
{
$data
[]
=
$str
;
}
else
{
continue
;
}
}
else
{
$bucket
=
$arr
[
0
];
$objectId
=
$arr
[
1
];
$url
=
Ksyun
::
getPicUrl
(
"merchant-b"
,
'goods_temp'
,
$bucket
.
'/'
.
$objectId
,
200
,
200
,
'jpeg'
);
$data
[]
=
$url
;
}
}
return
$data
;
}
...
...
@@ -1352,4 +1360,19 @@ class GoodsService
GoodsSkuPicRecord
::
save
(
$data
);
}
}
/**
* 当前没有初始化shop的地方,单拎出来一个接口
* @param array $params
* @return mixed
* @throws GoodsException
*/
public
static
function
initShop
(
$params
=
[])
{
$lifeAccount
=
[
"life_account_id"
=>
$params
[
"life_account_id"
],
"merchant_id"
=>
$params
[
"merchant_id"
],
];
return
self
::
addShop
(
$lifeAccount
);
}
}
\ No newline at end of file
vendor/api/php_services/src/Session/RedisSession.php
View file @
4bc152d8
...
...
@@ -10,6 +10,7 @@ class RedisSession extends Session
{
protected
$redis
=
null
;
protected
$key
=
'c071f6e5923a648a5ef88f32b6f738e1'
;
protected
$from
=
'bpsession'
;
/**
* 从cookie开启session
...
...
@@ -146,7 +147,7 @@ class RedisSession extends Session
}
$url
=
$this
->
getUrl
(
'delete'
);
$params
=
[
'sessionid'
=>
array_unique
(
$sessionIds
),
'key'
=>
$this
->
key
];
$params
=
[
'sessionid'
=>
array_unique
(
$sessionIds
),
'key'
=>
$this
->
key
,
'from'
=>
$this
->
from
];
$result
=
(
new
Request
())
->
post
(
$url
,
$params
,
0
,
'json'
);
if
(
isset
(
$result
[
'response'
][
'code'
])
&&
$result
[
'response'
][
'code'
]
==
0
)
{
return
true
;
...
...
@@ -182,7 +183,7 @@ class RedisSession extends Session
{
$data
=
[];
$url
=
$this
->
getUrl
(
'mget'
);
$params
=
[
'sessionid'
=>
$sessionIds
,
'key'
=>
$this
->
key
];
$params
=
[
'sessionid'
=>
$sessionIds
,
'key'
=>
$this
->
key
,
'from'
=>
$this
->
from
];
$result
=
(
new
Request
())
->
post
(
$url
,
$params
,
0
,
'json'
);
if
(
isset
(
$result
[
'response'
][
'code'
])
&&
$result
[
'response'
][
'code'
]
==
0
&&
isset
(
$result
[
'response'
][
'result'
])
&&
!
empty
(
$result
[
'response'
][
'result'
])
...
...
vendor/api/php_services/src/Session/RedisSessionHandler.php
View file @
4bc152d8
...
...
@@ -11,6 +11,7 @@ class RedisSessionHandler implements \SessionHandlerInterface
{
protected
$key
=
'c071f6e5923a648a5ef88f32b6f738e1'
;
protected
$expire
=
0
;
protected
$from
=
'bpsession'
;
/**
* open session
...
...
@@ -31,7 +32,7 @@ class RedisSessionHandler implements \SessionHandlerInterface
public
function
read
(
$sessionId
)
{
$url
=
$this
->
getUrl
(
'get'
);
$query
=
[
'sessionid'
=>
$sessionId
];
$query
=
[
'sessionid'
=>
$sessionId
,
'from'
=>
$this
->
from
];
$result
=
(
new
Request
())
->
get
(
$url
,
$query
);
$data
=
[];
if
(
isset
(
$result
[
'response'
][
'code'
])
&&
$result
[
'response'
][
'code'
]
==
0
&&
isset
(
$result
[
'response'
][
'result'
]))
{
...
...
@@ -52,7 +53,7 @@ class RedisSessionHandler implements \SessionHandlerInterface
return
true
;
}
$url
=
$this
->
getUrl
(
'set'
);
$params
=
[
'sessionid'
=>
$sessionId
,
'data'
=>
$_SESSION
,
'expire'
=>
$this
->
expire
,
'key'
=>
$this
->
key
];
$params
=
[
'sessionid'
=>
$sessionId
,
'data'
=>
$_SESSION
,
'expire'
=>
$this
->
expire
,
'key'
=>
$this
->
key
,
'from'
=>
$this
->
from
];
$result
=
(
new
Request
())
->
post
(
$url
,
$params
,
3000
,
'json'
);
if
(
isset
(
$result
[
'response'
][
'code'
])
&&
$result
[
'response'
][
'code'
]
==
0
)
{
return
true
;
...
...
@@ -77,7 +78,7 @@ class RedisSessionHandler implements \SessionHandlerInterface
public
function
destroy
(
$sessionId
)
{
$url
=
$this
->
getUrl
(
'delete'
);
$params
=
[
'sessionid'
=>
$sessionId
,
'key'
=>
$this
->
key
];
$params
=
[
'sessionid'
=>
$sessionId
,
'key'
=>
$this
->
key
,
'from'
=>
$this
->
from
];
$result
=
(
new
Request
())
->
post
(
$url
,
$params
,
3000
,
'json'
);
if
(
isset
(
$result
[
'response'
][
'code'
])
&&
$result
[
'response'
][
'code'
]
==
0
)
{
return
true
;
...
...
vendor/api/php_utils/src/Log/FileLog.php
View file @
4bc152d8
...
...
@@ -19,7 +19,7 @@ class FileLog
if
(
$with_access_log
)
{
$log
.=
' [request info:] '
.
self
::
accessLog
();
}
self
::
writeInfoL
og
(
$log
);
error_l
og
(
$log
);
}
/**
...
...
@@ -36,7 +36,7 @@ class FileLog
$exception_info
=
'In '
.
$exception
->
getFile
()
.
' on line '
.
$exception
->
getLine
()
.
' '
.
$exception
->
getCode
()
.
': '
.
$exception
->
getMessage
();
$log
.=
' [exception info: ]'
.
$exception_info
;
}
self
::
writeWarningL
og
(
$log
);
error_l
og
(
$log
);
}
/**
...
...
vendor/composer/InstalledVersions.php
View file @
4bc152d8
...
...
@@ -32,7 +32,7 @@ private static $installed = array (
'aliases'
=>
array
(
),
'reference'
=>
'
5ac6795e8e0cc669ee656822cfd491dd07c1f1a7
'
,
'reference'
=>
'
4c1fe21de0702d09b4178f5a5983abcd27f21135
'
,
'name'
=>
'yidian/yaf_demo'
,
),
'versions'
=>
...
...
@@ -45,7 +45,7 @@ private static $installed = array (
array
(
0
=>
'9999999-dev'
,
),
'reference'
=>
'
074d78a5d1a572489e8f59094f037fefcb3662a8
'
,
'reference'
=>
'
c16d46c6ebeefe757c65053f3bf82b7b9d6234d2
'
,
),
'api/php_utils'
=>
array
(
...
...
@@ -55,7 +55,7 @@ private static $installed = array (
array
(
0
=>
'9999999-dev'
,
),
'reference'
=>
'
3d3b07c4a7c3c486b05501c0b5dd9ec532b11ae5
'
,
'reference'
=>
'
5a63180a75dbc41881431c6056d7170514fcadf7
'
,
),
'bacon/bacon-qr-code'
=>
array
(
...
...
@@ -335,7 +335,7 @@ private static $installed = array (
'aliases'
=>
array
(
),
'reference'
=>
'
5ac6795e8e0cc669ee656822cfd491dd07c1f1a7
'
,
'reference'
=>
'
4c1fe21de0702d09b4178f5a5983abcd27f21135
'
,
),
),
);
...
...
vendor/composer/autoload_classmap.php
View file @
4bc152d8
...
...
@@ -94,6 +94,7 @@ return array(
'App\\Models\\goods\\mysql\\Category'
=>
$baseDir
.
'/application/models/goods/mysql/Category.php'
,
'App\\Models\\goods\\mysql\\GoodsOperationRecord'
=>
$baseDir
.
'/application/models/goods/mysql/GoodsOperationRecord.php'
,
'App\\Models\\goods\\mysql\\GoodsSku'
=>
$baseDir
.
'/application/models/goods/mysql/GoodsSku.php'
,
'App\\Models\\goods\\mysql\\GoodsSkuPicRecord'
=>
$baseDir
.
'/application/models/goods/mysql/GoodsSkuPicRecord.php'
,
'App\\Models\\goods\\mysql\\GoodsSkuSubShop'
=>
$baseDir
.
'/application/models/goods/mysql/GoodsSkuSubShop.php'
,
'App\\Models\\goods\\mysql\\GoodsSnapshot'
=>
$baseDir
.
'/application/models/goods/mysql/GoodsSnapshot.php'
,
'App\\Models\\goods\\mysql\\GoodsSpu'
=>
$baseDir
.
'/application/models/goods/mysql/GoodsSpu.php'
,
...
...
@@ -107,6 +108,7 @@ return array(
'App\\Models\\marketing\\mysql\\MarketingGoods'
=>
$baseDir
.
'/application/models/marketing/mysql/MarketingGoods.php'
,
'App\\Models\\shop\\mysql\\Shop'
=>
$baseDir
.
'/application/models/shop/mysql/Shop.php'
,
'App\\Models\\shop\\mysql\\SubShop'
=>
$baseDir
.
'/application/models/shop/mysql/SubShop.php'
,
'App\\Models\\tmp\\mysql\\QyqTicketData'
=>
$baseDir
.
'/application/models/tmp/mysql/QyqTicketData.php'
,
'App\\Plugins\\Hook'
=>
$baseDir
.
'/application/plugins/Hook.php'
,
'App\\Services\\common\\CommonService'
=>
$baseDir
.
'/application/services/common/CommonService.php'
,
'App\\Services\\demo\\ElasticService'
=>
$baseDir
.
'/application/services/demo/ElasticService.php'
,
...
...
vendor/composer/autoload_static.php
View file @
4bc152d8
...
...
@@ -323,6 +323,7 @@ class ComposerStaticInit90e85a2e64f8339192f3e91b8700b9f2
'App\\Models\\goods\\mysql\\Category'
=>
__DIR__
.
'/../..'
.
'/application/models/goods/mysql/Category.php'
,
'App\\Models\\goods\\mysql\\GoodsOperationRecord'
=>
__DIR__
.
'/../..'
.
'/application/models/goods/mysql/GoodsOperationRecord.php'
,
'App\\Models\\goods\\mysql\\GoodsSku'
=>
__DIR__
.
'/../..'
.
'/application/models/goods/mysql/GoodsSku.php'
,
'App\\Models\\goods\\mysql\\GoodsSkuPicRecord'
=>
__DIR__
.
'/../..'
.
'/application/models/goods/mysql/GoodsSkuPicRecord.php'
,
'App\\Models\\goods\\mysql\\GoodsSkuSubShop'
=>
__DIR__
.
'/../..'
.
'/application/models/goods/mysql/GoodsSkuSubShop.php'
,
'App\\Models\\goods\\mysql\\GoodsSnapshot'
=>
__DIR__
.
'/../..'
.
'/application/models/goods/mysql/GoodsSnapshot.php'
,
'App\\Models\\goods\\mysql\\GoodsSpu'
=>
__DIR__
.
'/../..'
.
'/application/models/goods/mysql/GoodsSpu.php'
,
...
...
@@ -336,6 +337,7 @@ class ComposerStaticInit90e85a2e64f8339192f3e91b8700b9f2
'App\\Models\\marketing\\mysql\\MarketingGoods'
=>
__DIR__
.
'/../..'
.
'/application/models/marketing/mysql/MarketingGoods.php'
,
'App\\Models\\shop\\mysql\\Shop'
=>
__DIR__
.
'/../..'
.
'/application/models/shop/mysql/Shop.php'
,
'App\\Models\\shop\\mysql\\SubShop'
=>
__DIR__
.
'/../..'
.
'/application/models/shop/mysql/SubShop.php'
,
'App\\Models\\tmp\\mysql\\QyqTicketData'
=>
__DIR__
.
'/../..'
.
'/application/models/tmp/mysql/QyqTicketData.php'
,
'App\\Plugins\\Hook'
=>
__DIR__
.
'/../..'
.
'/application/plugins/Hook.php'
,
'App\\Services\\common\\CommonService'
=>
__DIR__
.
'/../..'
.
'/application/services/common/CommonService.php'
,
'App\\Services\\demo\\ElasticService'
=>
__DIR__
.
'/../..'
.
'/application/services/demo/ElasticService.php'
,
...
...
vendor/composer/installed.json
View file @
4bc152d8
...
...
@@ -7,7 +7,7 @@
"source"
:
{
"type"
:
"git"
,
"url"
:
"https://git.yidian-inc.com:8021/bp/php_services.git"
,
"reference"
:
"
074d78a5d1a572489e8f59094f037fefcb3662a8
"
"reference"
:
"
c16d46c6ebeefe757c65053f3bf82b7b9d6234d2
"
},
"require"
:
{
"api/php_utils"
:
"dev-master"
,
...
...
@@ -15,7 +15,7 @@
"perftools/php-profiler"
:
"^0.18.0"
,
"php"
:
"7.2.*"
},
"time"
:
"2021-07-0
2T11:14:03
+00:00"
,
"time"
:
"2021-07-0
5T11:24:52
+00:00"
,
"default-branch"
:
true
,
"type"
:
"library"
,
"installation-source"
:
"source"
,
...
...
@@ -34,7 +34,7 @@
"source"
:
{
"type"
:
"git"
,
"url"
:
"https://git.yidian-inc.com:8021/bp/php_utils.git"
,
"reference"
:
"
3d3b07c4a7c3c486b05501c0b5dd9ec532b11ae5
"
"reference"
:
"
5a63180a75dbc41881431c6056d7170514fcadf7
"
},
"require"
:
{
"elasticsearch/elasticsearch"
:
"~7.0"
,
...
...
@@ -46,7 +46,7 @@
"mongodb/mongodb"
:
"1.4.3"
,
"php"
:
"7.2.*"
},
"time"
:
"2021-07-0
1T07:01:29
+00:00"
,
"time"
:
"2021-07-0
4T07:07:52
+00:00"
,
"default-branch"
:
true
,
"type"
:
"library"
,
"installation-source"
:
"source"
,
...
...
vendor/composer/installed.php
View file @
4bc152d8
...
...
@@ -6,7 +6,7 @@
'aliases'
=>
array
(
),
'reference'
=>
'
5ac6795e8e0cc669ee656822cfd491dd07c1f1a7
'
,
'reference'
=>
'
4c1fe21de0702d09b4178f5a5983abcd27f21135
'
,
'name'
=>
'yidian/yaf_demo'
,
),
'versions'
=>
...
...
@@ -19,7 +19,7 @@
array
(
0
=>
'9999999-dev'
,
),
'reference'
=>
'
074d78a5d1a572489e8f59094f037fefcb3662a8
'
,
'reference'
=>
'
c16d46c6ebeefe757c65053f3bf82b7b9d6234d2
'
,
),
'api/php_utils'
=>
array
(
...
...
@@ -29,7 +29,7 @@
array
(
0
=>
'9999999-dev'
,
),
'reference'
=>
'
3d3b07c4a7c3c486b05501c0b5dd9ec532b11ae5
'
,
'reference'
=>
'
5a63180a75dbc41881431c6056d7170514fcadf7
'
,
),
'bacon/bacon-qr-code'
=>
array
(
...
...
@@ -309,7 +309,7 @@
'aliases'
=>
array
(
),
'reference'
=>
'
5ac6795e8e0cc669ee656822cfd491dd07c1f1a7
'
,
'reference'
=>
'
4c1fe21de0702d09b4178f5a5983abcd27f21135
'
,
),
),
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment