|
|
|
@ -2,7 +2,9 @@ |
|
|
|
|
|
|
|
namespace App\Service\v3\Implementations; |
|
|
|
|
|
|
|
use App\Commons\Log; |
|
|
|
use App\Constants\v3\ErrorCode; |
|
|
|
use App\Constants\v3\LogLabel; |
|
|
|
use App\Exception\ErrorCodeException; |
|
|
|
use App\Service\v3\Interfaces\GoodsServiceInterface; |
|
|
|
use Hyperf\DbConnection\Db; |
|
|
|
@ -12,9 +14,15 @@ use App\Constants\v3\Store; |
|
|
|
use App\Constants\v3\goods as goodsConstants; |
|
|
|
use Hyperf\Redis\Redis; |
|
|
|
use Hyperf\Utils\ApplicationContext; |
|
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
|
|
|
|
|
class GoodsService implements GoodsServiceInterface |
|
|
|
{ |
|
|
|
/** |
|
|
|
* @Inject |
|
|
|
* @var Log |
|
|
|
*/ |
|
|
|
protected $log; |
|
|
|
public function do($goodsId) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -97,6 +105,27 @@ class GoodsService implements GoodsServiceInterface |
|
|
|
'on_sale' => $params['on_sale'], |
|
|
|
'is_infinite' => $params['is_infinite'] |
|
|
|
]; |
|
|
|
$this->log->event(LogLabel::CREATE_GOODS_LOG, ['logData' => json_encode( |
|
|
|
[ |
|
|
|
'id' => $params['id'], |
|
|
|
'market_id' => $params['market_id'], |
|
|
|
'store_id' => $params['store_id'], |
|
|
|
'name' => $params['name'], |
|
|
|
'category_id' => $params['category_id'], |
|
|
|
'goods_category_id' => $params['goods_category_id'], |
|
|
|
'goods_unit' => $params['goods_unit'], |
|
|
|
'price' => $params['price'], |
|
|
|
'original_price' => $params['original_price'], |
|
|
|
'inventory' => $params['inventory'], |
|
|
|
'restrict_num' => $params['restrict_num'], |
|
|
|
'start_num' => $params['start_num'], |
|
|
|
'spec' => $params['spec'], |
|
|
|
'tags' => $params['tags'], |
|
|
|
'remark' => $params['remark'], |
|
|
|
'on_sale' => $params['on_sale'], |
|
|
|
'is_infinite' => $params['is_infinite'] |
|
|
|
] |
|
|
|
)]); |
|
|
|
return Goods::create($data); |
|
|
|
} |
|
|
|
|
|
|
|
@ -127,6 +156,27 @@ class GoodsService implements GoodsServiceInterface |
|
|
|
'on_sale' => $params['on_sale'], |
|
|
|
'is_infinite' => $params['is_infinite'] |
|
|
|
]); |
|
|
|
$this->log->event(LogLabel::UPDATE_GOODS_LOG, ['logData' => json_encode( |
|
|
|
[ |
|
|
|
'id' => $params['id'], |
|
|
|
'market_id' => $params['market_id'], |
|
|
|
'store_id' => $params['store_id'], |
|
|
|
'name' => $params['name'], |
|
|
|
'category_id' => $params['category_id'], |
|
|
|
'goods_category_id' => $params['goods_category_id'], |
|
|
|
'goods_unit' => $params['goods_unit'], |
|
|
|
'price' => $params['price'], |
|
|
|
'original_price' => $params['original_price'], |
|
|
|
'inventory' => $params['inventory'], |
|
|
|
'restrict_num' => $params['restrict_num'], |
|
|
|
'start_num' => $params['start_num'], |
|
|
|
'spec' => $params['spec'], |
|
|
|
'tags' => $params['tags'], |
|
|
|
'remark' => $params['remark'], |
|
|
|
'on_sale' => $params['on_sale'], |
|
|
|
'is_infinite' => $params['is_infinite'] |
|
|
|
] |
|
|
|
)]); |
|
|
|
return $goods; |
|
|
|
} |
|
|
|
|
|
|
|
|