| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace app\controller\api\thirdParty;
- use app\common\repositories\third\ThirdPartyGoodCacheRepository;
- use think\db\exception\DbException;
- use think\Request;
- class ThirdPartyGoodCacheController
- {
- protected $repository;
- public function __construct(ThirdPartyGoodCacheRepository $repository)
- {
- $this->repository = $repository;
- }
- /**
- * @param Request $request
- * @return void
- */
- public function saveGoodCacheByFit(Request $request)
- {
- try {
- $thirdPartyGoodCacheEntity = $this->repository->saveGoodCacheByFit($request->param());
- return app("json")->success($thirdPartyGoodCacheEntity->toArray());
- } catch (DbException $e) {
- return app('json')->fail($e->getMessage(), null, 401);
- }
- }
- public function getGoodCache(Request $request)
- {
- if (empty($request['productId'])) {
- return app('json')->fail('缺少必要参数', null, 401);
- }
- $thirdPartyGoodCacheEntity = $this->repository->getThirdPartyGoodCacheEntityByProductId($request['productId']);
- return app("json")->success($thirdPartyGoodCacheEntity->toArray());
- }
- }
|