123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <?php
- namespace app\admin\server\medical;
- use app\admin\controller\medical\Shop;
- use app\admin\model\MedicalCareOrder;
- use app\admin\model\MedicalCareOrderProduct;
- use app\admin\model\MedicalCarePostage;
- use app\admin\model\MerchantShop;
- use app\admin\model\PackageOrderDetail;
- use app\admin\model\SystemAdmin;
- use app\admin\model\SystemMenu;
- use app\admin\model\SystemRole;
- class ShopServer
- {
- /**
- * Notes:获取店铺列表
- * @param string $keywords
- * @param int $page
- * @param int $limit
- * @return array
- * User: QJF
- * Date: 2022/9/30
- */
- public static function getShopList(int $page, int $limit, string $keywords)
- {
- [$list, $count] = MerchantShop::getShopList($page, $limit,$keywords);
- return compact('list', 'page', 'limit', 'count');
- }
- /**
- * Notes:获取店铺列表
- * @param string $keywords
- * @param int $page
- * @param int $limit
- * @return array
- * User: QJF
- * Date: 2022/11/08
- */
- public static function getHealthyShopList()
- {
- [$list] = MerchantShop::getHealthyShopList();
- return compact('list');
- }
- /**
- * Notes:根据分类获取店铺列表
- * @param int $category_id
- * @return array
- * User: ZQ
- * Date: 2022/11/8
- */
- public static function getCategoryShop($category_id)
- {
- $list = MerchantShop::getCategoryShop($category_id);
- return $list;
- }
- /**
- * Notes:店铺子集列表
- * @return array
- * User: ZQ
- * Date: 2022/11/8
- */
- public static function getCategorysShop()
- {
- $list = MerchantShop::getCategorysShop();
- return $list;
- }
- /**
- * Notes: 添加m店铺
- * @param array $param
- * @return int
- * User: QJF
- * Date: 2022/9/28
- */
- public static function insertShop(array $param)
- {
- MerchantShop::affairBegin();
- try {
- $param['shop_create_time'] = time();
- $result = MerchantShop::insertGetId($param);
- if (!empty($result)){
- MerchantShop::affairCommit();
- return $result;
- }
- throw new \Exception('操作失败!');
- }catch (\Exception $exception){
- MerchantShop::affairRollback();
- throw new \Exception($exception->getMessage(), 500);
- }
- }
- /**
- * Notes:修改产品
- * @param array $param
- * @return int
- * User: QJF
- * Date: 2022/9/23
- */
- public static function updateShop($param)
- {
- MerchantShop::affairBegin();
- try {
- $where = [];
- $where['shop_id'] = $param['shop_id'];
- $param['shop_update_time'] = time();
- $result = MerchantShop::where($where)->update($param);
- if ($result !== false){
- MerchantShop::affairCommit();
- return true;
- }
- throw new \Exception('操作失败!');
- }catch (\Exception $exception){
- MerchantShop::affairRollback();
- throw new \Exception($exception->getMessage(), 500);
- }
- }
- /**
- * Notes:删除产品
- * @param int $role_id
- * @return int
- * User: QJF
- * Date: 2022/9/23
- */
- public static function delShop($shop_id)
- {
- MerchantShop::affairBegin();
- try {
- $where = [];
- $where['shop_id'] = $shop_id;
- $data['shop_del'] = 1;
- $data['shop_update_time'] = time();
- $result = MerchantShop::where($where)->update($data);
- if (!empty($result)){
- MerchantShop::affairCommit();
- return true;
- }else{
- return false;
- }
- }catch (\Exception $exception){
- MerchantShop::affairRollback();
- throw new \Exception($exception->getMessage(), 500);
- }
- }
- /**
- * Notes:上/下架
- * @param int $role_id
- * @return int
- * User: QJF
- * Date: 2022/9/28
- */
- public static function showShop($shop_id,$product_status)
- {
- MerchantShop::affairBegin();
- try {
- $where = [];
- $where['shop_id'] = $shop_id;
- $data['shop_status'] = $product_status;
- $data['shop_update_time'] = time();
- $result = MerchantShop::where($where)->update($data);
- if (!empty($result)){
- MerchantShop::affairCommit();
- return true;
- }else{
- return false;
- }
- }catch (\Exception $exception){
- MerchantShop::affairRollback();
- throw new \Exception($exception->getMessage(), 500);
- }
- }
- /**
- * Notes:产品详情
- * @param int $package_id
- * @return int
- * User: QJF
- * Date: 2022/9/23
- */
- public static function infoShop($shop_id)
- {
- MerchantShop::affairBegin();
- try {
- $where = [];
- $where['shop_id'] = $shop_id;
- $result = MerchantShop::where($where)->first();
- if (!empty($result)){
- MerchantShop::affairCommit();
- return $result;
- }else{
- return false;
- }
- }catch (\Exception $exception){
- MerchantShop::affairRollback();
- throw new \Exception($exception->getMessage(), 500);
- }
- }
- }
|