SmartbcConfig.php 975 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 配置
  7. */
  8. namespace app\smartbc\model;
  9. use think\Model;
  10. class SmartbcConfig extends Model{
  11. protected $pk = 'id';
  12. //配置表
  13. public static function getConfig(int $miniapp_id){
  14. return self::where(['member_miniapp_id' => $miniapp_id])->find();
  15. }
  16. //获取所有配置
  17. public static function getAllConfig(){
  18. return self::select();
  19. }
  20. //编辑
  21. public static function configs(array $param,int $miniapp_id){
  22. $rel = self::where(['member_miniapp_id' => $miniapp_id])->find();
  23. if(empty($rel)){
  24. $param['member_miniapp_id'] = $miniapp_id;
  25. return self::insert($param);
  26. }else{
  27. return self::where(['member_miniapp_id' => $miniapp_id])->update($param);
  28. }
  29. }
  30. }