ShopExpressClass.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace biz\shop\classes;
  3. use common\components\util;
  4. use Yii;
  5. use biz\base\classes\BaseClass;
  6. class ShopExpressClass extends BaseClass
  7. {
  8. public static $baseFile = '\biz\shop\models\ShopExpress';
  9. //通过sjId, shopId 获取 快递方的门店ID
  10. public static function getShopNo($sjId,$shopId,$label='dada')
  11. {
  12. $where = [
  13. 'sjId'=>$sjId,
  14. 'shopId'=>$shopId,
  15. 'label'=>$label
  16. ];
  17. $res = self::getByCondition($where);
  18. if(empty($res)){
  19. //写入一条
  20. $data = $where;
  21. $data['shopNo'] = '';
  22. self::add($data);
  23. return '';
  24. }
  25. return $res['shopNo'];
  26. }
  27. public static function updateShopNo($sjId,$shopId,$shopNo,$label ='dada')
  28. {
  29. $where = [
  30. 'sJid'=>$sjId,
  31. 'shopId'=>$shopId,
  32. 'label'=>$label
  33. ];
  34. self::getShopNo($sjId,$label);
  35. self::updateByCondition($where,['shopNo'=>$shopNo]);
  36. return true;
  37. }
  38. }