微擎常用開(kāi)發(fā)文檔

1.tpl_form_field_daterange() - 范圍日期選擇器

tpl_form_field_daterange($name, $value = array(), $time = false)

{php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}

2. 城市選擇

{php echo tpl_form_field_district('address',array('province' =>$item['province'],'city'=>$item['city'],'district'=>$item['district']))}

php獲取 'province' => $_GPC['address']['province'],'city' => $_GPC['address']['city'],'district' => $_GPC['address']['district']

3.conmmon/herder 文件

/web/themes/default/common

4.獲取input name的值

var buynumber = $('input[name^='buynumber']').map(function(){return this.value}).get();

$('input[name='nw']').val();

5. 循環(huán)覆蓋

foreach($list as $key => &$value){ 

$bnumber= pdo_fetchcolumn('SELECT COUNT(*) FROM '.tablename('bc_party_payment').' WHERE status = 1 AND partyid = '.$value['id'] );

$value['bbnumber']=$bnumber;

//循環(huán)體 

}

6.判斷是否是管理員

{if $_W['role']== 'founder'}

7.人人彈窗:

t.confirm('確認(rèn)要支付嗎?', function () {

})

或者是

tip.confirm('確認(rèn)要支付嗎?', function () {

})

8.小程序數(shù)組賦值

'member.realname': e.detail.value

9.excel導(dǎo)入模板

<form action='{php echo $this->createWebUrl('excel', array());}' method='post' class='form-horizontal' role='form' enctype='multipart/form-data' onsubmit='return formcheck()'>

    <div class='form-group'>

     <label class='col-xs-2 control-label'>文件</label>

     <div class='col-xs-4 '>

      <input type='file' class='form-control' name='file' value='' />

     </div>

     <div class='col-xs-2'>

      <button class='btn btn-default'><i class='fa fa-search'></i> 導(dǎo)入</button>

     </div>

     <div class='col-xs-4'>

      <a class='btn btn-primary' href='{$_W['attachurl']}phone.xls'>下載導(dǎo)入模板</a>

     </div>

    </div>

隱藏上傳文件

PHP:::::

$url = $this->createWebUrl('eggManage',array());

  $file = $_FILES['file'];

  if(!$file['size']){

   message('文件上傳不能為空!',  '', 'error');

  }

  if( $file['name'] && $file['error'] == 0){

   $type = @end( explode('.', $file['name']));

   $type = strtolower($type);

   if( !in_array($type, array('xls','xlsx')) ){

    message('文件類(lèi)型錯(cuò)誤!',  '', 'error');

   }

   set_time_limit(0);

   include_once IA_ROOT . '/framework/library/phpexcel/PHPExcel.php';

   include_once IA_ROOT . '/framework/library/phpexcel/PHPExcel/IOFactory.php';

   if( $type == 'xls' ){

    $inputFileType = 'Excel5';    //這個(gè)是讀 xls的

   }else{

    $inputFileType = 'Excel2007';//這個(gè)是計(jì)xlsx的

   }

$objReader = PHPExcel_IOFactory::createReader($inputFileType);

$objPHPExcel = $objReader->load($file['tmp_name']);

$sheet = $objPHPExcel->getSheet(0);

 //獲取行數(shù)與列數(shù),注意列數(shù)需要轉(zhuǎn)換

$highestRow = $sheet->getHighestRow();

$highestColumn = $sheet->getHighestColumn();

$highestColumnNum = PHPExcel_Cell::columnIndexFromString($highestColumn);

$usefullColumnNum = $highestColumnNum;

for ($row = 2;$row <= $highestRow;$row++){

$tel = $sheet->getCellByColumnAndRow(0, $row)->getValue();//身份證

    $data = array(

'tel' => $tel,

);

pdo_insert('mon_egg_success',$data);

   }

   message('導(dǎo)入成功', $url,'success');

  }else{

   message('導(dǎo)入失敗', '','error');

  }

10..$_W['member']

array(9) {

['uid']=>

string(1) '5'

['realname']=>

string(0) ''

['mobile']=>

string(0) ''

['email']=>

string(39) '[406ccc5616a09420b75252e3db50a05b@we7.cc](mailto:406ccc5616a09420b75252e3db50a05b@we7.cc)'

['groupid']=>

string(1) '1'

['credit1']=>

string(4) '0.00'

['credit2']=>

string(4) '0.00'

['credit6']=>

string(4) '0.00'

['groupname']=>

string(15) '默認(rèn)會(huì)員組'

}

11.$_W['fans']

array(19) {

['fanid']=>

string(1) '5'

['acid']=>

string(1) '1'

['uniacid']=>

string(1) '1'

['uid']=>

string(1) '5'

['openid']=>

string(28) 'o3f7twP_3Qdnj1ntcR9ChzHGyrIY'

['nickname']=>

string(23) 'A0松石網(wǎng)絡(luò)~蛋蛋'

['groupid']=>

string(0) ''

['salt']=>

string(8) 'JYY3nY5o'

['follow']=>

string(1) '0'

['followtime']=>

string(1) '0'

['unfollowtime']=>

string(1) '0'

['tag']=>

array(9) {

['openid']=>

string(28) 'o3f7twP_3Qdnj1ntcR9ChzHGyrIY'

['nickname']=>

string(23) 'A0松石網(wǎng)絡(luò)~蛋蛋'

['sex']=>

int(1)

['language']=>

string(5) 'zh_CN'

['city']=>

string(6) '臨沂'

['province']=>

string(6) '山東'

['country']=>

string(6) '中國(guó)'

['privilege']=>

array(0) {

}

['avatar']=>

string(128) '[http://thirdwx.qlogo.cn/mmopen/vi_32/p83UpvULG4E9MbCfmia1Ocfpfv86L8yVEMtEF8QJMjOasrfsXFvfazdV5aPo20E6J7aQbA1xOlZsCMsXcpcwRug/132](http://thirdwx.qlogo.cn/mmopen/vi_32/p83UpvULG4E9MbCfmia1Ocfpfv86L8yVEMtEF8QJMjOasrfsXFvfazdV5aPo20E6J7aQbA1xOlZsCMsXcpcwRug/132)'

}

['updatetime']=>

string(10) '1534752827'

['unionid']=>

string(0) ''

['sex']=>

int(1)

['gender']=>

int(1)

['headimgurl']=>

string(128) '[http://thirdwx.qlogo.cn/mmopen/vi_32/p83UpvULG4E9MbCfmia1Ocfpfv86L8yVEMtEF8QJMjOasrfsXFvfazdV5aPo20E6J7aQbA1xOlZsCMsXcpcwRug/132](http://thirdwx.qlogo.cn/mmopen/vi_32/p83UpvULG4E9MbCfmia1Ocfpfv86L8yVEMtEF8QJMjOasrfsXFvfazdV5aPo20E6J7aQbA1xOlZsCMsXcpcwRug/132)'

['avatar']=>

string(128) '[http://thirdwx.qlogo.cn/mmopen/vi_32/p83UpvULG4E9MbCfmia1Ocfpfv86L8yVEMtEF8QJMjOasrfsXFvfazdV5aPo20E6J7aQbA1xOlZsCMsXcpcwRug/132](http://thirdwx.qlogo.cn/mmopen/vi_32/p83UpvULG4E9MbCfmia1Ocfpfv86L8yVEMtEF8QJMjOasrfsXFvfazdV5aPo20E6J7aQbA1xOlZsCMsXcpcwRug/132)'

['from_user']=>

string(28) 'o3f7twP_3Qdnj1ntcR9ChzHGyrIY'

}

12.JS 地區(qū)獲取

var  province = $('input[name='address[province]']').val();

var  city = $('input[name='address[city]']').val();

var  district = $('input[name='address[district]']').val();

13.獲取數(shù)據(jù)庫(kù)最后一個(gè)id

$member=pdo_fetch('select * from ims_bc_party_member order by mid desc LIMIT 1');

14.支付返回?cái)?shù)據(jù)

調(diào)用payResult文件目錄 payment/wechat/pay.php
array(14) { ['weid']=> string(1) '1' ['uniacid']=> string(1) '1' ['result']=> string(7) 'success' ['type']=> string(6) 'wechat' ['from']=> string(6) 'return' ['tid']=> string(14) '20181537167703' ['uniontid']=> string(28) '2018091715014600001344588486' ['user']=> string(28) 'o5OgN00jIN9BH1u6-M2q69CRvOg0' ['fee']=> string(4) '0.01' ['tag']=> array(3) { ['acid']=> string(1) '1' ['uid']=> string(2) '14' ['transaction_id']=> string(28) '4200000162201809176669855405' } ['is_usecard']=> string(1) '0' ['card_type']=> string(1) '0' ['card_fee']=> string(4) '0.01' ['card_id']=> string(1) '0' } 1

15.app端手機(jī)上傳多圖片刪除功能

{php echo tpl_app_form_field_image('multi-image');}

          {if $images}

        <div class="mui-image-preview js-image-preview mui-pull-right mui-image-uploader">

            {loop $images $pic}

            <div class="multi-item">

            <input type="hidden" value="{$pic}" name="piclist[]">

            <img src="{php echo tomedia($pic)}"  data-preview-src="" data-preview-group="__IMG_UPLOAD_piclist">

            <em class="close"  title="刪除這張圖片" onclick="deletePic(this)">×</em>

            </div>

            {/loop}

16.微擎公眾號(hào)首次關(guān)注發(fā)送信息代碼

數(shù)據(jù)庫(kù):ims_wechat_news
ims_uni_settings 修改觸發(fā)關(guān)鍵字的內(nèi)容

添加或者刪除
ims_core_cache(太復(fù)雜)

image.png

17.微擎JSDK

<script>
            
            
var jssdkconfig = {php echo json_encode($_W['account']['jssdkconfig']);} || { jsApiList:[] };    

jssdkconfig.jsApiList = ['getLocation']   
wx.config(jssdkconfig);
 wx.ready(function () {
    wx.checkJsApi({
        jsApiList: [
            'getLocation'
        ],
        
        success: function (res) {
            // alert(JSON.stringify(res));
            // alert(JSON.stringify(res.checkResult.getLocation));
            if (res.checkResult.getLocation == false) {
                alert('你的微信版本太低,不支持微信JS接口,請(qǐng)升級(jí)到最新的微信版本!');
                return;
            }
        }
    }); 
    wx.error(function(res){
        alert("接口調(diào)取失敗")
    });
    wx.getLocation({
      success: function (res) {

        $.post()

        
        // 創(chuàng)建地理編碼實(shí)例      
        var myGeo = new BMap.Geocoder();      
        // 根據(jù)坐標(biāo)得到地址描述    
        $.post("demo_ajax_gethint.html",{suggest:txt},function(result){
            $("span").html(result);
        });
      },
      cancel: function (res) {
        alert('用戶(hù)拒絕授權(quán)獲取地理位置');
      }
    });
});
 


    </script>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 自己做dede的開(kāi)發(fā)時(shí)間也比較長(zhǎng)了,基本上常用的函數(shù)都知道在哪個(gè)文件里面,但是時(shí)間一長(zhǎng),也有點(diǎn)模糊了,俗話(huà)說(shuō):好記...
    大劉的英語(yǔ)世界閱讀 1,904評(píng)論 1 9
  • Spring Cloud為開(kāi)發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見(jiàn)模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,506評(píng)論 19 139
  • Getting Started Use the Current Stable Version (7.1) Buil...
    Leonzai閱讀 2,051評(píng)論 0 3
  • 2018/05/28,13/28 冥想時(shí)長(zhǎng):約9分鐘 今日總結(jié): 1、今天早上一起床就進(jìn)行了冥想練習(xí),但那時(shí)頭腦昏...
    依然如水閱讀 406評(píng)論 0 1
  • 最近下雨,好像腦子又進(jìn)水了。跟朋友一起出去吃飯,看到一面墻上爬滿(mǎn)了爬山虎,輕輕綠綠的,忽然腦洞就打開(kāi)了。 爬山虎上...
    子曰少懷閱讀 579評(píng)論 8 4

友情鏈接更多精彩內(nèi)容