MobileChain.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Lang;
  4. /**
  5. * ============================================================================
  6. * DSO2O多用户商城
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 控制器
  14. */
  15. class MobileChain extends MobileHome {
  16. protected $chain_info;
  17. public function initialize() {
  18. parent::initialize();
  19. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/chain.lang.php');
  20. $key = request()->header('X-DS-KEY');
  21. if ($key) {
  22. $mbchaintoken_model = model('mbchaintoken');
  23. $chain_token = $mbchaintoken_model->getMbchaintokenInfo(array('chain_token' => $key));
  24. if (!$chain_token) {
  25. ds_json_encode(40001, lang('chain_token_expire'));
  26. }
  27. $chain_model = model('chain');
  28. $chain_info = $chain_model->getChainInfo(array('chain_id' => $chain_token['chain_id']));
  29. if(!$chain_info){
  30. ds_json_encode(40001, lang('chain_not_exist'));
  31. }
  32. if(request()->action()!='apply_again' && request()->action()!='information'){
  33. if($chain_info['chain_state']!=1){
  34. ds_json_encode(40001, lang('chain_not_open'));
  35. }
  36. }
  37. $this->chain_info= $chain_info;
  38. } else {
  39. ds_json_encode(10001, 'Hacking Attempt');
  40. }
  41. }
  42. }
  43. ?>